/* Word counter + QR code generator (/tools/word-counter/, /tools/qr-code-generator/ and their
   /ko/tools/ pairs). Loaded after /css/clean-home.css and /tools/shared/audio-task.css. */

/* Korean pages: Noto Sans KR for Hangul, no breaks inside words. */
html[lang="ko"] body.home-clean {
  font-family: 'Plus Jakarta Sans', 'Noto Sans KR', system-ui, -apple-system, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  word-break: keep-all;
  overflow-wrap: break-word;
}
html[lang="ko"] .at-hero h1 { letter-spacing: -0.02em; }
html[lang="ko"] .at-meter span, html[lang="ko"] .wc-big span { letter-spacing: 0; text-transform: none; }

.at-tool textarea, .at-tool input[type="text"], .at-tool input[type="url"], .at-tool input[type="email"],
.at-tool input[type="tel"] {
  font: inherit; font-size: 16px; color: var(--et-ink); background: #fff; width: 100%; min-width: 0;
  border: 1.5px solid #E2D9F5; border-radius: 10px; padding: 9px 12px; min-height: 44px; font-weight: 500;
}
.at-tool textarea { resize: vertical; line-height: 1.6; }
.at-tool textarea:focus-visible, .at-tool input[type="text"]:focus-visible, .at-tool input[type="url"]:focus-visible,
.at-tool input[type="email"]:focus-visible, .at-tool input[type="tel"]:focus-visible,
.at-tool summary:focus-visible, .at-tool input[type="color"]:focus-visible {
  outline: 3px solid rgba(130, 87, 230, .45); outline-offset: 2px;
}
.at-tool summary { cursor: pointer; font-weight: 800; font-size: .98rem; padding: 4px 0; }

.lang-switch { color: var(--et-purple-dark); font-weight: 700; text-decoration: none; }
.lang-switch:hover { text-decoration: underline; }

/* ----------------------------------------------------------------- word counter */

.wc-primary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
@media (max-width: 640px) { .wc-primary { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.wc-big { background: #FBF9FF; border: 1px solid #F1ECF9; border-radius: 14px; padding: 10px 12px; min-width: 0; }
.wc-big span { display: block; font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--et-mute); }
.wc-big strong { display: block; font-size: clamp(1.35rem, 5vw, 1.7rem); font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.2; margin-top: 2px; overflow-wrap: anywhere; }

.wc-target { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; margin-top: 14px; padding-top: 14px; border-top: 1px solid #F1ECF9; }
.wc-target + .at-step { margin-top: 20px; padding-top: 18px; border-top: 1px solid #F1ECF9; }
.wc-target .at-unit { font-size: 14px; color: var(--et-ink); font-weight: 700; }
.wc-target input[type="number"] { width: 6em; }
.wc-target select { max-width: 100%; }
.wc-presets { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.wc-limit { margin: 0 0 12px; }
.wc-bar { height: 10px; border-radius: 999px; background: #EEE7FA; overflow: hidden; }
.wc-bar span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--et-purple); transition: width .15s ease; }
.wc-limit.is-near .wc-bar span { background: #D98A12; }
.wc-limit.is-over .wc-bar span { background: #C2352B; }
.wc-limit-text { font-size: 14px; margin-top: 6px; font-variant-numeric: tabular-nums; color: var(--et-mute); }
.wc-limit-text strong { color: var(--et-ink); }
.wc-limit.is-over .wc-limit-text { color: #8A2219; font-weight: 700; }

.wc-text { min-height: 260px; font-size: 17px !important; }
.wc-actions { margin-top: 10px; }
.wc-actions .at-check { margin-left: auto; }
@media (max-width: 520px) { .wc-actions .at-check { margin-left: 0; } }
.wc-crlf { margin-top: 12px; }
.wc-action-msg { font-size: 13.5px; color: var(--et-mute); }

.wc-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.wc-stats > div { background: #FBF9FF; border: 1px solid #F1ECF9; border-radius: 12px; padding: 9px 12px; min-width: 0; }
.wc-stats dt { font-size: 12.5px; font-weight: 700; color: var(--et-mute); }
.wc-stats dd { font-size: 1.15rem; font-weight: 800; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.wc-stats dd small { font-size: 12px; font-weight: 600; color: var(--et-mute); }
@media (max-width: 400px) { .wc-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.wc-top table { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 8px; }
.wc-top th, .wc-top td { text-align: left; padding: 6px 8px; border-bottom: 1px solid #F1ECF9; }
.wc-top th { font-size: 12px; color: var(--et-mute); font-weight: 800; }
.wc-top td:nth-child(n+2), .wc-top th:nth-child(n+2) { text-align: right; font-variant-numeric: tabular-nums; }
.wc-top td:first-child { overflow-wrap: anywhere; }

/* ---------------------------------------------------------------- QR generator */

.qr-types { gap: 6px; }
.qr-type-set + .qr-layout { margin-top: 18px; padding-top: 18px; border-top: 1px solid #F1ECF9; }
/* Desktop: inputs and style on the left, preview on the right. Phones: inputs, preview, style (DOM order). */
.qr-layout {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 300px); gap: 0 22px; align-items: start;
  grid-template-areas: "inputs output" "options output";
}
.qr-inputs { grid-area: inputs; min-width: 0; }
.qr-output { grid-area: output; }
.qr-options { grid-area: options; min-width: 0; }
@media (max-width: 760px) {
  .qr-layout { grid-template-columns: minmax(0, 1fr); grid-template-areas: "inputs" "output" "options"; gap: 18px 0; }
  .qr-layout .qr-options { margin-top: 0; }
}
.qr-panel { display: grid; gap: 12px; }
.qr-panel .at-field { font-size: 14px; }
.qr-panel textarea { min-height: 110px; }
.qr-panel .at-grid { gap: 12px 14px; }
.qr-options { margin-top: 18px; padding-top: 16px; border-top: 1px solid #F1ECF9; }
.qr-options .at-grid { gap: 12px 14px; }
.qr-color { display: flex; align-items: center; gap: 10px; }
.qr-color input[type="color"] { width: 48px; height: 40px; padding: 2px; border: 1.5px solid #E2D9F5; border-radius: 10px; background: #fff; cursor: pointer; flex: none; }
.qr-color code { font-size: 13px; color: var(--et-mute); font-weight: 600; }
.qr-output { position: sticky; top: 16px; display: grid; gap: 12px; min-width: 0; }
@media (max-width: 760px) { .qr-output { position: static; } }
.qr-preview {
  width: 100%; max-width: 300px; aspect-ratio: 1; margin: 0 auto; display: grid; place-items: center;
  border-radius: 14px; border: 1px solid #EEE7FA; overflow: hidden;
  background: repeating-conic-gradient(#F4F1FA 0% 25%, #fff 0% 50%) 50% / 16px 16px;
}
.qr-preview svg { width: 100%; height: 100%; display: block; }
.qr-empty { color: var(--et-mute); font-size: 14px; text-align: center; padding: 20px; }
.qr-output .at-row .at-btn { flex: 1 1 100%; white-space: nowrap; }
.qr-payload { margin: 8px 0 0; padding: 10px 12px; border-radius: 10px; background: #FBF9FF; border: 1px solid #F1ECF9; font-size: 12.5px; white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-all; max-height: 200px; overflow: auto; }
.qr-info { font-size: 13px; color: var(--et-mute); text-align: center; font-variant-numeric: tabular-nums; }
