/* 배우기 화면 (templates/study.html). 5-1 E: 공통 부품과 같은 값. 색·모서리·그림자·간격은 common.css의 토큰(var(--…))만 쓴다 (색 값을 직접 쓰지 않는다).
   마크업·class는 그대로라서 ui-* class를 붙이지 않고 같은 토큰으로 같은 모양을 만든다:
   배우는 언어 칸·단어 카드 = 카드, 배우는 언어 버튼 = 고르는 칩(44px, 고른 칩은 주색 바탕 + ✓), 같은 언어 = 점선 꺼진 칩,
   상태 안내·오류·버튼 = /meals와 같은 값(info·위험색 띠, 52px 버튼), 같은 언어 안내·발음 안내 = warn 띠, 발음 듣기 = 보조(secondary) 알약 버튼 44px.
   글자: 단어·뜻·예문·읽는 법·버튼 16px 이상, 안내 14px 이상, "예문" 이름표 13px.
   모바일(360px)을 먼저 만들고 넓은 화면은 카드를 여러 열로 (칸 최소 폭 260px, 화면 폭이 그보다 좁으면 한 열).
   가로 스크롤이 생기지 않게 고정 너비 대신 %·grid·minmax를 쓴다. 마우스를 올려야만 보이는 것(hover)은 없다.
   position은 화면 읽기 프로그램용 숨김 글자(.study-sr-only) 하나에만 쓴다. */

[hidden] { display: none !important; } /* display를 정한 요소도 hidden이면 확실히 숨긴다 */

.study-page { max-width: 1040px; }

/* ---------- 배우는 언어 고르기 = 카드 ---------- */
.study-target {
  border: 1px solid var(--line); /* v2 카드: 1px 선 */
  min-width: 0;
  margin-top: var(--space-4);
  padding: var(--space-4);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.study-target-label {
  margin: 0 0 var(--space-3);
  font-size: 16px;
  font-weight: 700;
  line-height: var(--lh-body);
  overflow-wrap: anywhere;
}

.study-target-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 120px), 1fr));
  gap: var(--space-2);
}

/* 배우는 언어 버튼 = 고르는 칩 (알약, 1px 선, 44px 이상, 글자 16px) */
.study-target-btn {
  min-width: 0;
  max-width: 100%;
  min-height: 44px;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 16px;
  font-weight: 500;
  line-height: var(--lh-label);
  text-align: center;
  overflow-wrap: anywhere;
  cursor: pointer;
}

.study-target-btn[aria-pressed="true"] {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--on-primary);
}

/* 눌린 버튼에는 ✓도 붙인다 (색만으로 구분하지 않는다). 지원하는 브라우저에서는 ✓를 따로 읽지 않는다 */
.study-target-btn[aria-pressed="true"]::before {
  content: "✓ ";
  content: "✓ " / "";
}

/* 화면 언어와 같은 언어: 점선 + 꺼진 색 (누르면 안내가 나온다) */
.study-target-btn[aria-disabled="true"] {
  border-style: dashed;
  border-color: var(--text-sub);
  background: var(--bg);
  color: var(--text-sub);
  cursor: not-allowed;
}

.study-target-btn:focus-visible,
.study-btn:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

/* 같은 언어를 눌렀을 때의 안내 = warn 띠 */
.study-notice {
  margin: var(--space-3) 0 0;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--r-md);
  background: var(--warning-soft);
  color: var(--warning);
  font-size: 14px;
  line-height: var(--lh-body);
  overflow-wrap: anywhere;
}

/* ---------- 상태 안내 · 오류 (/meals와 같은 모양) ---------- */
.study-message {
  margin: var(--space-4) 0 0;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--r-md);
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: 16px;
  line-height: var(--lh-body);
  overflow-wrap: anywhere;
}

/* 화면에는 안 보이고 화면 읽기 프로그램만 읽는 글자 ("단어를 불러왔어요") */
.study-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.study-error {
  margin-top: var(--space-4);
  padding: var(--space-4);
  border-radius: var(--r-md);
  background: var(--danger-soft);
  color: var(--danger);
}

.study-error-text {
  margin: 0 0 var(--space-3);
  font-size: 16px;
  line-height: var(--lh-body);
  overflow-wrap: anywhere;
}

/* 버튼 (primary): 높이 52 이상, 모서리 16, 16px. 폰에서는 칸을 꽉 채우고 넓은 화면에서는 글자만큼 */
.study-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 100%;
  min-height: 52px;
  padding: var(--space-3) var(--space-5);
  border: 0;
  border-radius: var(--r-md);
  background: var(--primary);
  color: var(--on-primary);
  font: inherit;
  font-size: 16px;
  font-weight: 500;
  line-height: var(--lh-body);
  text-align: center;
  text-decoration: none;
  overflow-wrap: anywhere;
  cursor: pointer;
}

/* ---------- 요약 · 퀴즈 링크 ---------- */
.study-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-3);
  margin-top: var(--space-4);
}

/* "단어 N개": 안내 14px */
.study-summary {
  min-width: 0;
  margin: 0;
  color: var(--text-sub);
  font-size: 14px;
  font-weight: 700;
  line-height: var(--lh-body);
  overflow-wrap: anywhere;
}

/* ---------- 단어장 ---------- */
.study-section { min-width: 0; margin-top: var(--space-6); }

.study-section-title {
  margin: 0 0 var(--space-3);
  font-size: var(--fs-heading);
  font-weight: 700;
  line-height: var(--lh-heading);
  overflow-wrap: anywhere;
}

.study-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: var(--space-3);
}

/* 단어 카드 = 카드 (흰 바탕, 모서리 16, 안쪽 16, 그림자, 테두리 없음) */
.study-card {
  border: 1px solid var(--line); /* v2 카드: 1px 선 */
  min-width: 0;
  padding: var(--space-4);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  overflow-wrap: anywhere;
}

/* 배우는 언어의 단어 (가장 크게) */
.study-word {
  margin: 0;
  font-size: clamp(22px, 6vw, 28px);
  font-weight: 700;
  line-height: var(--lh-display);
}

/* 읽는 법: 소리 내어 읽는 글자라 본문 크기, 흐린 글자 */
.study-reading {
  margin: 2px 0 0;
  color: var(--text-sub);
  font-size: 16px;
  line-height: var(--lh-body);
}

/* 화면 언어의 뜻 */
.study-meaning {
  margin: var(--space-2) 0 0;
  color: var(--primary-dark);
  font-size: 17px;
  font-weight: 700;
  line-height: var(--lh-body);
}

.study-example {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--line);
}

/* "예문" 이름표 (Caption 13px) */
.study-example-label {
  margin: 0 0 2px;
  color: var(--text-sub);
  font-size: var(--fs-caption);
  font-weight: 700;
  line-height: var(--lh-caption);
}

.study-example-target {
  margin: 0;
  font-size: 16px;
  line-height: var(--lh-body);
}

.study-example-screen {
  margin: 2px 0 0;
  color: var(--text-sub);
  font-size: 16px;
  line-height: var(--lh-body);
}

/* ---------- 발음 듣기 (2-7): 카드마다 보조 알약 버튼 하나(44px), 누를 때만 소리. 안내는 위 칸(role=status)과 누른 카드 안에 ---------- */
.study-listen {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  min-width: 0;
  margin-top: var(--space-2);
}

.study-listen-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  max-width: 100%;
  min-height: 44px;
  padding: var(--space-2) var(--space-4);
  border: 0;
  border-radius: var(--r-pill);
  background: var(--primary-soft);
  color: var(--primary-dark);
  font: inherit;
  font-size: 16px;
  font-weight: 500;
  line-height: var(--lh-label);
  text-align: center;
  overflow-wrap: anywhere;
  cursor: pointer;
}

.study-listen-icon { flex: none; font-size: 18px; line-height: 1; }

.study-listen-btn:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

/* 발음 안내 = warn 띠 (위 칸), 카드 안에서는 띠 없이 같은 색 글자 */
.study-voice {
  margin: var(--space-4) 0 0;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--r-md);
  background: var(--warning-soft);
  color: var(--warning);
  font-size: 14px;
  line-height: var(--lh-body);
  overflow-wrap: anywhere;
}

.study-voice-inline {
  flex: 1 1 100%;
  min-width: 0;
  margin: 0;
  color: var(--warning);
  font-size: 14px;
  line-height: var(--lh-body);
  overflow-wrap: anywhere;
}

@media (min-width: 768px) {
  .study-btn { width: auto; }
}
