/* 1. 기본 스타일 */
body {
  font-family: 'Pretendard Variable', -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  padding-top: 5rem;
  background-color: white;
  text-align: center;
}

/* 2. 접근성용 숨김 */
.visually-hidden {
  position: absolute !important;
  height: 1px; width: 1px;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  white-space: nowrap;
}

/* 3. 고정 상단 헤더 */
#page-title {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  padding: 1.2rem 0;
  font-size: 1.8rem;
  font-weight: 700;
  background: white;
  border-bottom: 1px solid #ddd;
  z-index: 1000;
  cursor: pointer;
}

/* 4. h2 및 정의 블록 */
h2 {
  font-size: 1.3rem;
  font-weight: 600;
  margin-top: 3rem;
  margin-bottom: 0.5rem;
}
h2 + p {
  font-size: 1rem;
  font-style: italic;
  opacity: 0.85;
  max-width: 42rem;
  margin: 0 auto 2rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #e0e0e0;
}

/* 영문만 Orbit 서체 적용 */
:lang(en) {
  font-family: 'Orbit', sans-serif;
}

/* 5. "모두 열기 / 모두 닫기" 버튼 블록 */
#list-controls {
  margin: 1rem auto;
  display: inline-flex;
  gap: 0.5rem;
}

/* 6. 단어 토글 항목 */
.entries > details {
  padding: 0.75rem 2rem;
  margin-bottom: 0;
  border-top: 1px solid var(--sep, #d9d9d9);
}
.entries > details:first-of-type {
  border-top: none;
}
.entries > details > summary {
  margin-bottom: 0.2rem;
  font-size: 1.1rem;
  font-weight: 400;
}
summary .label-ko { display: inline; }
summary .label-en { display: none; }
summary:hover .label-ko,
summary:focus-visible .label-ko { display: none; }
summary:hover .label-en,
summary:focus-visible .label-en { display: inline; }
summary::-webkit-details-marker { display: none; }
summary::marker { content: ""; }

/* 정의 영역 */
.my-definition {
  font-size: 0.88rem;
  margin-top: 1rem;
}
.my-definition p {
  line-height: 1.7;
  margin: 0.35rem 0;
}

/* 7. 토글 호버/열림 시 배경 변화 */
:root {
  --item-hover: rgba(0, 0, 0, 0.04);
  --item-open: rgba(0, 0, 0, 0.06);
}
.entries > details:hover,
.entries > details:focus-within {
  background: var(--item-hover);
}
.entries > details[open] {
  background: var(--item-open);
}

/* 8. 정의 링크 스타일 */
.dict-link-line {
  margin-top: 0.5rem;
}
.ins-link {
  text-decoration: underline;
  opacity: 0.82;
  transition: opacity .15s, text-decoration-thickness .15s;
}
.ins-link:hover,
.ins-link:focus-visible {
  opacity: 1;
  text-decoration-thickness: 2px;
}

/* 9. 하단 고정 "나에게 궁금한 점은?" 버튼 */
#search-trigger {
  position: fixed;
  bottom: 0;
  width: 100%;
  background: black;
  text-align: center;
  z-index: 999;
}
#trigger-search {
  background: black;
  color: white;
  border: none;
  padding: 0.75rem 1rem;
  width: 100%;
  max-width: 42rem;
  font-size: 0.95rem;
  cursor: pointer;
}

/* 10. 토글 검색창 */
#search-bar {
  display: none;
}
#search-bar.active {
  display: block;
  position: fixed;
  bottom: 2.75rem;
  width: 100%;
  background: #f5f5f5;
  padding: 1.5rem 1rem;
  border-top: 1px solid #eee;
  z-index: 998;
}
#search-form {
  max-width: 42rem;
  margin: 0 auto;
}
#search-form input[type="search"] {
  width: 100%;
  max-width: 30rem;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: 0.5rem;
}

/* 옵션과 상태 */
.search-options {
  margin-top: 0.5rem;
  margin-bottom: 0.25rem;
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  font-size: 0.95rem;
}
#clear {
  background: none;
  border: none;
  color: #888;
  cursor: pointer;
  text-decoration: underline;
}
#search-status {
  font-size: 0.9rem;
  color: #666;
  margin-top: 0.5rem;
}

/* 11. 기타 유틸 */
body, h1, h2, summary, .my-definition, .dict-link-line {
  text-align: center;
}

/* 화면 어두운 테마용 색 변수 */
@media (prefers-color-scheme: dark) {
  :root {
    --item-hover: rgba(255, 255, 255, 0.06);
    --item-open: rgba(255, 255, 255, 0.10);
    --sep: #555;
  }
}

#toggle-all {
  background: white;
  color: black;
  border: 1px solid black;
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

#toggle-all.active {
  background: black;
  color: white;
}

.entries > details[open] > summary {
  font-weight: 600;
}

.my-definition {
  padding-bottom: 1rem; /* 아래 공간 추가 (선택사항) */
}

.dict-link-line {
  margin-top: 1.5rem; /* 기존보다 간격 넓힘 */
}

details[open] > summary + .my-definition {
  margin-top: 1rem;  /* 기존보다 여백 증가 */
}

body.search-open {
  padding-bottom: 10rem; /* 검색창 높이만큼 공간 확보 */
}
