/* counter-container – styled like charactercalculator.com/he/average-word-length/ */

.counter-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 896px;
  margin: 0 auto 1.5rem;
  font-family: 'Arimo', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.counter-card {
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.counter-grid {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-areas:
    "text-header"
    "text-body"
    "text-footer"
    "stats-header"
    "stats-list"
    "stats-footer";
}

.counter-panel-header { grid-area: text-header; }
.counter-stats-header { grid-area: stats-header; }
.counter-text-body { grid-area: text-body; }
.counter-list { grid-area: stats-list; }
.counter-panel-footer { grid-area: text-footer; }
.counter-stats-footer { grid-area: stats-footer; }

.counter-panel-header,
.counter-stats-header {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 4rem;
  padding: 0 1rem;
  box-sizing: border-box;
  border-bottom: 1px solid #e5e5e5;
}

.counter-panel-header {
  position: relative;
}

.counter-panel-header .counter-btn {
  position: absolute;
  inset-inline-start: 0.75rem;
}

.counter-panel-header h2,
.counter-stats-header h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
}

.counter-text-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.counter-textarea {
  display: block;
  width: calc(100% - 1.5rem);
  max-width: 100%;
  flex: 1;
  min-width: 0;
  min-height: 20rem;
  margin: 0.75rem auto;
  padding: 1.5rem;
  border: 1px solid #e5e5e5;
  border-radius: 6px;
  resize: none;
  font: inherit;
  font-size: 14px;
  line-height: 1.6;
  box-sizing: border-box;
  background: #fff;
  color: #1a1a1a;
  outline: none;
}

.counter-textarea:focus {
  border-color: #bdbdbd;
}

.counter-textarea::placeholder {
  color: #999;
}

.counter-panel-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 3rem;
  padding: 0 0.75rem;
  box-sizing: border-box;
  border-top: 1px solid #e5e5e5;
}

.counter-stats-footer {
  display: grid;
  grid-template-columns: 1rem 1fr auto;
  align-items: center;
  gap: 1rem;
  height: 3rem;
  padding: 0 1rem;
  box-sizing: border-box;
  border-top: 1px solid #e5e5e5;
}

.counter-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 0.75rem;
  min-height: 2rem;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: #1a1a1a;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s;
}

.counter-btn:hover {
  background: #f5f5f5;
}

.counter-btn svg {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

.counter-upload {
  display: none;
}

.counter-list {
  list-style: none;
  margin: 0;
  padding: 0;
  min-width: 0;
  border-top: none;
}

.counter-list-row {
  display: grid;
  grid-template-columns: 1rem 1fr auto;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  border-bottom: 1px solid #e5e5e5;
  box-sizing: border-box;
}

.counter-list-row:last-child {
  border-bottom: none;
}

.counter-icon {
  color: rgba(26, 26, 26, 0.4);
  display: flex;
  align-items: center;
}

.counter-icon svg {
  width: 1rem;
  height: 1rem;
}

.counter-label {
  font-size: 0.875rem;
  color: rgba(26, 26, 26, 0.7);
}

.counter-value {
  font-size: 1.125rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: #1a1a1a;
}

.word-length-intro {
  max-width: 850px;
  margin: 8px auto 10px;
  padding: 0 15px;
  line-height: 1.7;
  font-size: 16px;
  color: #333;
  text-align: center;
}

.word-length-content {
  max-width: 850px;
  margin: 35px auto 20px;
  padding: 0 15px;
  line-height: 1.8;
  font-size: 16px;
  color: #222;
  text-align: right;
}

.word-length-content h2 {
  font-size: 24px;
  line-height: 1.4;
  margin: 32px 0 12px;
  color: #111;
}

.word-length-content h3 {
  font-size: 19px;
  line-height: 1.5;
  margin: 24px 0 7px;
  color: #222;
}

.word-length-content p {
  margin: 0 0 15px;
}

.word-length-content ul,
.word-length-content ol {
  margin: 10px 0 20px;
  padding-right: 25px;
}

.word-length-content li {
  margin-bottom: 7px;
}

.word-length-more {
  margin: 20px 0 0;
}

.word-length-more a {
  color: blue;
  text-decoration: none;
}

@media (min-width: 768px) {
  .counter-grid {
    grid-template-columns: 4fr 3fr;
    grid-template-rows: 4rem 1fr 3rem;
    grid-template-areas:
      "text-header stats-header"
      "text-body   stats-list"
      "text-footer stats-footer";
  }

  .counter-panel-header {
    grid-area: text-header;
    border-inline-end: 1px solid #e5e5e5;
  }

  .counter-stats-header {
    grid-area: stats-header;
  }

  .counter-text-body {
    grid-area: text-body;
    border-inline-end: 1px solid #e5e5e5;
  }

  .counter-list {
    grid-area: stats-list;
    align-self: stretch;
  }

  .counter-panel-footer {
    grid-area: text-footer;
    border-inline-end: 1px solid #e5e5e5;
  }

  .counter-stats-footer {
    grid-area: stats-footer;
  }
}

@media (max-width: 767px) {
  .counter-container {
    gap: 0;
    margin: 0 auto 0.75rem;
  }

  .counter-panel-header,
  .counter-stats-header {
    height: 2.1rem;
    padding: 0 0.55rem;
  }

  .counter-panel-header h2,
  .counter-stats-header h2 {
    font-size: 0.95rem;
  }

  .counter-stats-header {
    border-top: 1px solid #e5e5e5;
  }

  .counter-textarea {
    min-height: calc(3.5rem + 40px);
    height: calc(3.5rem + 40px);
    margin: 0.25rem auto;
    padding: 0.4rem 0.55rem;
    font-size: 13px;
  }

  .counter-panel-footer {
    display: none;
  }

  .counter-stats-footer {
    height: 2rem;
  }

  .counter-list-row {
    padding: 0.28rem 0.65rem;
    gap: 0.5rem;
  }

  .counter-list-row:first-child {
    background: #fafafa;
  }

  .counter-label {
    font-size: 0.78rem;
  }

  .counter-value {
    font-size: 0.92rem;
  }

  .word-length-intro,
  .word-length-content {
    font-size: 15px;
    line-height: 1.75;
  }

  .word-length-intro {
    margin: 4px auto 6px;
    padding: 0 10px;
    font-size: 14px;
    line-height: 1.5;
  }

  .word-length-content h2 {
    font-size: 21px;
  }

  .word-length-content h3 {
    font-size: 18px;
  }
}
