/* ============================================================
   깨알도구
   단어 수 세기

   공통 구조는 tool-common.css 사용
   ============================================================ */

.word-count-page {
  --tool-page-max-width: 920px;
}

/* ============================================================
   TEXTAREA
   ============================================================ */

.word-textarea {
  display: block;

  width: 100%;
  min-height: 340px;

  padding: 14px 15px;

  resize: vertical;

  border: 1px solid var(--line);
  border-radius: var(--tool-input-radius);

  background: #ffffff;

  color: var(--text);

  outline: none;

  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.75;

  box-sizing: border-box;

  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.word-textarea:focus {
  border-color: var(--accent);

  box-shadow: 0 0 0 3px rgba(217, 164, 65, 0.1);
}

.word-textarea::placeholder {
  color: #aaa9a3;
}

/* ============================================================
   INPUT META
   ============================================================ */

.word-input-meta {
  display: flex;

  align-items: center;
  justify-content: space-between;

  gap: 10px;

  margin-top: 6px;

  color: var(--text-soft);

  font-size: var(--tool-help-size);
}

.word-input-meta span:last-child {
  flex: 0 0 auto;

  font-variant-numeric: tabular-nums;
}

/* ============================================================
   RESULT PANEL
   ============================================================ */

.word-result-panel {
  min-height: 0;

  justify-content: flex-start;
}

/* ============================================================
   STATUS
   ============================================================ */

.word-status {
  width: 100%;

  min-height: 35px;

  display: flex;

  align-items: center;
  justify-content: center;

  margin-bottom: 13px;

  padding: 7px 10px;

  border-radius: 9px;

  background: var(--surface-soft);

  color: var(--text-soft);

  font-size: 12px;
  font-weight: 750;
  line-height: 1.45;

  text-align: center;

  box-sizing: border-box;
}

.word-status.is-active {
  background: #eef8f1;

  color: #39734b;
}

/* ============================================================
   MAIN
   ============================================================ */

.word-main-result {
  padding: 24px 15px;

  border-radius: 14px;

  background: linear-gradient(145deg, #202737, #111722);

  color: #ffffff;

  text-align: center;
}

.word-main-result span {
  display: block;

  color: rgba(255, 255, 255, 0.62);

  font-size: 12px;
  font-weight: 800;
}

.word-main-result strong {
  display: inline-block;

  margin-top: 3px;

  font-size: 46px;
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -2px;

  font-variant-numeric: tabular-nums;
}

.word-main-result small {
  margin-left: 4px;

  color: #ffd979;

  font-size: 12px;
  font-weight: 800;
}

/* ============================================================
   PRIMARY GRID
   ============================================================ */

.word-primary-grid {
  display: grid;

  grid-template-columns: repeat(2, minmax(0, 1fr));

  gap: 7px;

  margin-top: 10px;
}

.word-primary-grid > div {
  min-width: 0;

  padding: 13px 10px;

  border: 1px solid var(--line);
  border-radius: 11px;

  background: #ffffff;

  text-align: center;
}

.word-primary-grid span {
  display: block;

  color: var(--text-soft);

  font-size: 12px;
  font-weight: 750;
}

.word-primary-grid strong {
  display: inline-block;

  margin-top: 3px;

  color: var(--text);

  font-size: 23px;
  font-weight: 900;

  font-variant-numeric: tabular-nums;
}

.word-primary-grid small {
  margin-left: 2px;

  color: var(--text-soft);

  font-size: 12px;
}

/* ============================================================
   DETAIL STATS
   ============================================================ */

.word-stat-grid {
  display: grid;

  grid-template-columns: repeat(4, minmax(0, 1fr));

  gap: 6px;

  margin-top: 7px;
}

.word-stat {
  min-width: 0;

  padding: 10px 5px;

  border-radius: 9px;

  background: var(--surface-soft);

  text-align: center;
}

.word-stat span {
  display: block;

  color: var(--text-soft);

  font-size: 12px;
  font-weight: 750;
}

.word-stat strong {
  display: block;

  margin-top: 3px;

  color: var(--text);

  font-size: 12px;
  font-weight: 900;

  overflow-wrap: anywhere;

  font-variant-numeric: tabular-nums;
}

/* ============================================================
   TARGET
   ============================================================ */

.word-target-box {
  margin-top: 15px;

  padding: 13px;

  border: 1px solid var(--line);
  border-radius: 11px;

  background: #ffffff;
}

.word-target-head {
  display: flex;

  align-items: center;
  justify-content: space-between;

  gap: 10px;
}

.word-target-head span {
  display: block;

  color: var(--text);

  font-size: 12px;
  font-weight: 850;
}

.word-target-head strong {
  display: block;

  margin-top: 2px;

  color: var(--text-soft);

  font-size: 12px;
}

.word-target-head b {
  color: var(--brand);

  font-size: 16px;
  font-weight: 900;

  font-variant-numeric: tabular-nums;
}

/* ============================================================
   PROGRESS
   ============================================================ */

.word-progress {
  width: 100%;
  height: 10px;

  margin-top: 10px;

  overflow: hidden;

  border-radius: 999px;

  background: var(--surface-soft);
}

.word-progress span {
  display: block;

  width: 0;
  height: 100%;

  border-radius: inherit;

  background: linear-gradient(90deg, #e0aa44, #f4cc69);

  transition: width 0.2s ease;
}

.word-progress.is-over span {
  background: linear-gradient(90deg, #e67567, #ef9b7c);
}

/* ============================================================
   TARGET INFO
   ============================================================ */

.word-target-info {
  display: flex;

  align-items: center;
  justify-content: space-between;

  gap: 10px;

  margin-top: 6px;

  color: var(--text-soft);

  font-size: 12px;
}

.word-target-info strong {
  color: var(--text);

  font-size: 12px;
  font-weight: 800;
}

/* ============================================================
   FREQUENCY
   ============================================================ */

.word-frequency-box {
  margin-top: 12px;

  padding: 12px;

  border: 1px solid var(--line);
  border-radius: 11px;

  background: #ffffff;
}

.word-frequency-head {
  display: flex;

  align-items: flex-start;
  justify-content: space-between;

  gap: 10px;

  margin-bottom: 8px;
}

.word-frequency-head > div {
  min-width: 0;
}

.word-frequency-head strong {
  color: var(--text);

  font-size: 12px;
  font-weight: 850;
}

.word-frequency-head span {
  margin-left: 4px;

  color: var(--accent);

  font-size: 12px;
  font-weight: 900;
}

.word-frequency-head small {
  flex: 0 0 auto;

  color: var(--text-soft);

  font-size: 12px;
}

.word-frequency-list {
  display: grid;

  gap: 5px;
}

.word-frequency-row {
  display: grid;

  grid-template-columns:
    21px
    minmax(0, 1fr)
    auto;

  align-items: center;

  gap: 7px;

  padding: 7px 8px;

  border-radius: 8px;

  background: var(--surface-soft);
}

.word-frequency-rank {
  width: 21px;
  height: 21px;

  display: flex;

  align-items: center;
  justify-content: center;

  border-radius: 50%;

  background: #ffffff;

  color: var(--text-soft);

  font-size: 12px;
  font-weight: 900;
}

.word-frequency-word {
  min-width: 0;

  overflow: hidden;

  text-overflow: ellipsis;

  white-space: nowrap;

  color: var(--text);

  font-size: 12px;
  font-weight: 800;
}

.word-frequency-count {
  flex: 0 0 auto;

  color: var(--brand);

  font-size: 12px;
  font-weight: 900;

  font-variant-numeric: tabular-nums;
}

.word-frequency-empty {
  padding: 13px 7px;

  color: var(--text-soft);

  font-size: 12px;
  line-height: 1.5;

  text-align: center;
}

/* ============================================================
   NOTE
   ============================================================ */

.word-note {
  margin-top: 11px;

  padding: 10px 11px;

  border-radius: 9px;

  background: var(--surface-soft);
}

.word-note strong {
  display: block;

  color: var(--text);

  font-size: 12px;
  font-weight: 850;
}

.word-note p {
  margin: 3px 0 0;

  color: var(--text-soft);

  font-size: 12px;
  line-height: 1.55;
}

/* ============================================================
   TABLET
   ============================================================ */

@media (max-width: 760px) {
  .word-result-panel {
    order: -1;
  }

  .word-textarea {
    min-height: 280px;
  }
}

/* ============================================================
   MOBILE
   ============================================================ */

@media (max-width: 520px) {
  .word-textarea {
    min-height: 240px;

    padding: 12px;

    font-size: 13px;
  }

  .word-main-result {
    padding: 20px 12px;
  }

  .word-main-result strong {
    font-size: 40px;
  }

  .word-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .word-target-info {
    flex-direction: column;

    align-items: flex-start;

    gap: 2px;
  }
}
