/* ============================================
   레이아웃 — 헤더 / 사이드바 광고 / 본문 그리드 / 푸터
   ============================================ */

.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.app-header__brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 20px;
  color: var(--text);
}
.app-header__brand .icon { color: var(--primary); }

.app-header__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

.lang-select {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path fill='%238B95A1' d='M4 6l4 4 4-4'/></svg>") no-repeat right 10px center;
  background-size: 12px;
  border-radius: var(--radius);
  padding: 8px 30px 8px 12px;
  font-family: 'Montserrat', sans-serif;
  font-weight: 500;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
}
.lang-select:focus { outline: 2px solid var(--primary); }

.icon-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  color: var(--text);
  cursor: pointer;
  transition: .15s;
}
.icon-btn:hover { background: var(--bg); border-color: var(--sub); }

/* 헤더에 직접 표기되는 사용 방법 / 개인정보 안내 링크 */
.header-link {
  border: none;
  background: none;
  padding: 6px 4px;
  font-family: 'Montserrat', sans-serif;
  font-weight: 500;
  font-size: 14px;
  color: var(--sub);
  cursor: pointer;
  transition: .15s;
}
.header-link:hover { color: var(--primary-dark); }

/* 본문 3열 그리드: 좌측 광고 | 콘텐츠 | 우측 광고 */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr) var(--sidebar-width);
  gap: 24px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px 20px 40px;
  align-items: start;
}

/* 애드센스 승인 전까지는 빈 여백만 차지하고, 시각적으로는 아무 표시도 하지 않는다.
   승인 후 이 컨테이너 안에 실제 애드센스 코드를 넣으면 동일한 자리에 광고가 나타난다. */
.ad-slot {
  position: sticky;
  top: calc(var(--header-height) + 24px);
  min-height: 480px;
}

.ad-slot--mobile {
  display: none;
  min-height: 0;
  position: static;
}

.main-content {
  min-width: 0;
}

/* 태블릿 이하: 사이드바 광고 숨김, 모바일 하단 광고 노출 */
@media (max-width: 1023px) {
  .app-shell {
    grid-template-columns: 1fr;
    padding: 16px 16px 32px;
  }
  .ad-slot--side { display: none; }
  .ad-slot--mobile { display: flex; }
}

@media (max-width: 480px) {
  .app-header { padding: 0 12px; }
  .app-header__brand { font-size: 17px; }
}

.app-footer {
  text-align: center;
  padding: 24px 20px 40px;
  color: var(--sub);
  font-size: 13px;
}
.footer-nav {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 8px;
}

/* 모달 공통 */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 200;
}
.modal-overlay.is-open { display: flex; }

.modal {
  background: var(--surface);
  border-radius: var(--radius);
  max-width: 520px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  padding: 24px;
  box-shadow: 0 20px 40px rgba(0,0,0,.2);
}
.modal--wide { max-width: 640px; }

.modal-intro {
  font-size: 14px;
  color: var(--text);
  font-weight: 500;
  margin: 0 0 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.modal__body {
  color: var(--text);
  font-size: 14px;
  line-height: 1.7;
}

.modal-list {
  margin: 4px 0 0;
  padding-left: 20px;
}
.modal-list li { margin-bottom: 10px; }
.modal-list li:last-child { margin-bottom: 0; }
.modal-list--ordered { padding-left: 22px; }
