/* ==========================================================================
   dictation / style.css
   이 도구에서만 쓰는 스타일. 색·간격은 css/common.css 의 CSS 변수만 씁니다.

   🔴 CSP 가 style-src 'self' 라 인라인 style 을 못 씁니다.
      진행 막대 길이는 data-pct 속성으로 넘기고 파일 끝의 규칙이 폭을 정합니다.
   ========================================================================== */

/* 화면에는 안 보이지만 스크린 리더는 읽는 문구 */
.visually-hidden {
  position: absolute;
  overflow: hidden;
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  margin: -1px;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* --- 설정 화면 ------------------------------------------------------------- */

.textarea-tall {
  min-height: 132px;
  line-height: 1.6;
  resize: vertical;
}



.custom-warning {
  color: var(--color-warning);
  font-weight: var(--weight-bold);
}

.notice--warn {
  border: 1px solid var(--color-warning);
  margin-top: 0;
  margin-bottom: var(--space-5);
  color: var(--color-warning);
  font-weight: var(--weight-bold);
}

.empty-note {
  max-width: 46ch;
  margin: var(--space-3) auto 0;
  font-size: 14px;
}

/* --- 연습 화면 ------------------------------------------------------------- */

.practice-panel {
  margin-top: var(--space-6);
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-border);
}

.practice-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.practice-count {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 14px;
  font-weight: var(--weight-bold);
}

.practice-quit {
  min-height: 44px;
  padding: var(--space-2) var(--space-4);
  font-size: 14px;
}

.bar {
  overflow: hidden;
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--color-surface-soft);
}

.bar__fill {
  display: block;
  height: 100%;
  border-radius: var(--radius-pill);
  background: var(--color-primary);
  transition: width 180ms ease;
}

.listen-box {
  margin-top: var(--space-5);
  padding: var(--space-5);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-soft);
}

.listen-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.listen-main {
  min-width: 140px;
}

.gap-field {
  margin-top: var(--space-4);
}

.gap-label {
  display: block;
  padding: 0;
  margin-bottom: var(--space-2);
  color: var(--color-text-muted);
  font-size: 13px;
  font-weight: var(--weight-bold);
}

.chip-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-2);
  max-width: 420px;
}

.chip {
  position: relative;
  display: flex;
  min-height: 44px; /* STYLE.md: 터치 대상 최소 44px */
  align-items: center;
  justify-content: center;
  padding: var(--space-1) var(--space-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text-muted);
  font-size: 14px;
  font-weight: var(--weight-bold);
  text-align: center;
}

.chip:has(input:checked) {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

/* 라디오를 1px·opacity:0 으로 숨겼으니 포커스 링은 라벨이 대신 그립니다. */
.chip:has(input:focus-visible) {
  outline: 3px solid var(--color-focus);
  outline-offset: 3px;
}

.chip input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.play-status {
  min-height: 24px;
  margin: var(--space-4) 0 0;
  color: var(--color-text-muted);
  font-size: 14px;
  font-weight: var(--weight-bold);
}

.answer-box {
  margin-top: var(--space-5);
}

.answer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.reveal-box {
  margin: var(--space-4) 0 0;
  padding: var(--space-4);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface-soft);
  font-size: 18px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

/* --- 채점 결과(문장 하나) ---------------------------------------------------- */

.check-panel {
  margin-top: var(--space-5);
  padding: var(--space-5);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.check-head {
  margin-bottom: var(--space-4);
}

.check-score {
  margin: 0 0 var(--space-1);
  font-size: 19px;
  font-weight: var(--weight-bold);
}

.check-comment,
.check-origin,
.check-ko {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.check-origin {
  margin-top: var(--space-4);
}

.check-ko {
  margin-top: var(--space-1);
}

.check-subhead {
  margin-top: var(--space-4);
  margin-bottom: var(--space-2);
  font-size: 15px;
}

/* --- 단어별 비교 ----------------------------------------------------------- */

.diff {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-2);
  margin: 0;
  font-size: 18px;
  line-height: 1.9;
  overflow-wrap: anywhere;
}

.dtok {
  display: inline-flex;
  align-items: baseline;
  gap: var(--space-1);
  padding: 0 2px;
  border-bottom: 2px solid transparent;
}

.dtok--ok {
  color: var(--color-text);
}

.dtok--wrong {
  border-bottom-color: var(--color-danger);
}

.dtok--miss {
  border-bottom-color: var(--color-warning);
}

.dtok--extra {
  border-bottom-style: dotted;
  border-bottom-color: var(--color-text-muted);
}

.dtok__typed {
  color: var(--color-danger);
  text-decoration: line-through;
}

.dtok--extra .dtok__typed {
  color: var(--color-text-muted);
}

.dtok--wrong .dtok__ref {
  color: var(--color-success);
  font-weight: var(--weight-bold);
}

.dtok--wrong .dtok__ref::before {
  margin-right: 2px;
  content: "→";
}

.dtok--miss .dtok__ref {
  color: var(--color-warning);
  font-weight: var(--weight-bold);
}

.dtok--miss .dtok__ref::before {
  margin-right: 2px;
  content: "＋";
}

.dtok__tag {
  padding: 0 var(--space-1);
  border-radius: var(--radius-pill);
  background: var(--color-surface-soft);
  color: var(--color-text-muted);
  font-size: 11px;
  font-weight: var(--weight-bold);
}

.diff-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
  padding: 0;
  margin: var(--space-4) 0 0;
  color: var(--color-text-muted);
  font-size: 13px;
  list-style: none;
}

.diff-legend li {
  display: flex;
  align-items: baseline;
  gap: var(--space-1);
}

.diff-legend .dtok {
  font-size: 14px;
}

/* --- 최종 결과 ------------------------------------------------------------- */

.score-card {
  padding: var(--space-5);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-soft);
  text-align: center;
}

.score-card__label {
  margin: 0 0 var(--space-1);
  color: var(--color-text-muted);
  font-size: 14px;
  font-weight: var(--weight-bold);
}

.score-card__value {
  margin: 0;
  color: var(--color-primary);
  font-size: clamp(38px, 9vw, 56px);
  font-weight: var(--weight-bold);
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.score-card__detail {
  margin: var(--space-2) 0 0;
  color: var(--color-text-muted);
  font-size: 14px;
}

.score-card__comment {
  max-width: 52ch;
  margin: var(--space-3) auto 0;
  font-size: 15px;
}

.result-subhead {
  margin-top: var(--space-6);
  margin-bottom: var(--space-3);
  font-size: 17px;
}

.wrong-box {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.wrong-chip {
  display: flex;
  flex-direction: column;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  font-size: 15px;
  overflow-wrap: anywhere;
}

.wrong-chip__detail {
  color: var(--color-text-muted);
  font-size: 12px;
  font-weight: var(--weight-bold);
}

.wrong-empty {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 14px;
}

.result-list {
  display: grid;
  gap: var(--space-3);
}

.result-item {
  padding: var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.result-item__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.result-item__no {
  margin: 0;
  font-size: 14px;
  font-weight: var(--weight-bold);
}

.result-item .diff {
  font-size: 16px;
}

.result-item__line {
  margin: var(--space-3) 0 0;
  color: var(--color-text-muted);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.result-item__ko {
  margin-top: var(--space-1);
}

.result-item__flag {
  margin: var(--space-2) 0 0;
  color: var(--color-warning);
  font-size: 13px;
  font-weight: var(--weight-bold);
}

.button--small {
  min-height: 44px; /* STYLE.md: 터치 대상 최소 44px */
  padding: var(--space-2) var(--space-3);
  font-size: 13px;
}

.form-actions--wrap {
  flex-wrap: wrap;
  margin-top: var(--space-5);
}

/* --- 좁은 화면 ------------------------------------------------------------- */

@media (max-width: 760px) {
  .practice-top,
  .result-item__head {
    align-items: stretch;
    flex-direction: column;
  }

  .listen-actions .button,
  .answer-actions .button,
  .form-actions--wrap .button {
    width: 100%;
  }

  .chip-grid {
    max-width: none;
  }

  .wrong-chip {
    width: 100%;
  }

  .diff {
    font-size: 17px;
  }
}

/* --- 진행 막대 길이 ---------------------------------------------------------
   🔴 인라인 style 이 CSP 로 막혀 있어, JS 는 data-pct="0"~"100" 만 넣고
      폭은 아래 규칙이 정합니다.
   -------------------------------------------------------------------------- */
.bar__fill[data-pct="0"] { width: 0%; }
.bar__fill[data-pct="1"] { width: 1%; }
.bar__fill[data-pct="2"] { width: 2%; }
.bar__fill[data-pct="3"] { width: 3%; }
.bar__fill[data-pct="4"] { width: 4%; }
.bar__fill[data-pct="5"] { width: 5%; }
.bar__fill[data-pct="6"] { width: 6%; }
.bar__fill[data-pct="7"] { width: 7%; }
.bar__fill[data-pct="8"] { width: 8%; }
.bar__fill[data-pct="9"] { width: 9%; }
.bar__fill[data-pct="10"] { width: 10%; }
.bar__fill[data-pct="11"] { width: 11%; }
.bar__fill[data-pct="12"] { width: 12%; }
.bar__fill[data-pct="13"] { width: 13%; }
.bar__fill[data-pct="14"] { width: 14%; }
.bar__fill[data-pct="15"] { width: 15%; }
.bar__fill[data-pct="16"] { width: 16%; }
.bar__fill[data-pct="17"] { width: 17%; }
.bar__fill[data-pct="18"] { width: 18%; }
.bar__fill[data-pct="19"] { width: 19%; }
.bar__fill[data-pct="20"] { width: 20%; }
.bar__fill[data-pct="21"] { width: 21%; }
.bar__fill[data-pct="22"] { width: 22%; }
.bar__fill[data-pct="23"] { width: 23%; }
.bar__fill[data-pct="24"] { width: 24%; }
.bar__fill[data-pct="25"] { width: 25%; }
.bar__fill[data-pct="26"] { width: 26%; }
.bar__fill[data-pct="27"] { width: 27%; }
.bar__fill[data-pct="28"] { width: 28%; }
.bar__fill[data-pct="29"] { width: 29%; }
.bar__fill[data-pct="30"] { width: 30%; }
.bar__fill[data-pct="31"] { width: 31%; }
.bar__fill[data-pct="32"] { width: 32%; }
.bar__fill[data-pct="33"] { width: 33%; }
.bar__fill[data-pct="34"] { width: 34%; }
.bar__fill[data-pct="35"] { width: 35%; }
.bar__fill[data-pct="36"] { width: 36%; }
.bar__fill[data-pct="37"] { width: 37%; }
.bar__fill[data-pct="38"] { width: 38%; }
.bar__fill[data-pct="39"] { width: 39%; }
.bar__fill[data-pct="40"] { width: 40%; }
.bar__fill[data-pct="41"] { width: 41%; }
.bar__fill[data-pct="42"] { width: 42%; }
.bar__fill[data-pct="43"] { width: 43%; }
.bar__fill[data-pct="44"] { width: 44%; }
.bar__fill[data-pct="45"] { width: 45%; }
.bar__fill[data-pct="46"] { width: 46%; }
.bar__fill[data-pct="47"] { width: 47%; }
.bar__fill[data-pct="48"] { width: 48%; }
.bar__fill[data-pct="49"] { width: 49%; }
.bar__fill[data-pct="50"] { width: 50%; }
.bar__fill[data-pct="51"] { width: 51%; }
.bar__fill[data-pct="52"] { width: 52%; }
.bar__fill[data-pct="53"] { width: 53%; }
.bar__fill[data-pct="54"] { width: 54%; }
.bar__fill[data-pct="55"] { width: 55%; }
.bar__fill[data-pct="56"] { width: 56%; }
.bar__fill[data-pct="57"] { width: 57%; }
.bar__fill[data-pct="58"] { width: 58%; }
.bar__fill[data-pct="59"] { width: 59%; }
.bar__fill[data-pct="60"] { width: 60%; }
.bar__fill[data-pct="61"] { width: 61%; }
.bar__fill[data-pct="62"] { width: 62%; }
.bar__fill[data-pct="63"] { width: 63%; }
.bar__fill[data-pct="64"] { width: 64%; }
.bar__fill[data-pct="65"] { width: 65%; }
.bar__fill[data-pct="66"] { width: 66%; }
.bar__fill[data-pct="67"] { width: 67%; }
.bar__fill[data-pct="68"] { width: 68%; }
.bar__fill[data-pct="69"] { width: 69%; }
.bar__fill[data-pct="70"] { width: 70%; }
.bar__fill[data-pct="71"] { width: 71%; }
.bar__fill[data-pct="72"] { width: 72%; }
.bar__fill[data-pct="73"] { width: 73%; }
.bar__fill[data-pct="74"] { width: 74%; }
.bar__fill[data-pct="75"] { width: 75%; }
.bar__fill[data-pct="76"] { width: 76%; }
.bar__fill[data-pct="77"] { width: 77%; }
.bar__fill[data-pct="78"] { width: 78%; }
.bar__fill[data-pct="79"] { width: 79%; }
.bar__fill[data-pct="80"] { width: 80%; }
.bar__fill[data-pct="81"] { width: 81%; }
.bar__fill[data-pct="82"] { width: 82%; }
.bar__fill[data-pct="83"] { width: 83%; }
.bar__fill[data-pct="84"] { width: 84%; }
.bar__fill[data-pct="85"] { width: 85%; }
.bar__fill[data-pct="86"] { width: 86%; }
.bar__fill[data-pct="87"] { width: 87%; }
.bar__fill[data-pct="88"] { width: 88%; }
.bar__fill[data-pct="89"] { width: 89%; }
.bar__fill[data-pct="90"] { width: 90%; }
.bar__fill[data-pct="91"] { width: 91%; }
.bar__fill[data-pct="92"] { width: 92%; }
.bar__fill[data-pct="93"] { width: 93%; }
.bar__fill[data-pct="94"] { width: 94%; }
.bar__fill[data-pct="95"] { width: 95%; }
.bar__fill[data-pct="96"] { width: 96%; }
.bar__fill[data-pct="97"] { width: 97%; }
.bar__fill[data-pct="98"] { width: 98%; }
.bar__fill[data-pct="99"] { width: 99%; }
.bar__fill[data-pct="100"] { width: 100%; }
