/* =========================
   TERMS
========================= */

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background-color: #ffffff;
}

button {
  font-family: inherit;
}

.terms-screen {
  width: 100%;
  max-width: 100%;
  min-height: 100dvh;
  padding-bottom: env(safe-area-inset-bottom);
  background-color: #ffffff;
}

/* =========================
   헤더 (강제 정렬)
========================= */

.terms-screen {
  padding-top: 0 !important;
  margin-top: 0 !important;
}

.terms-header {
  position: sticky !important;
  top: 0 !important;
  z-index: 20;
  width: 100%;
  box-sizing: border-box;
  /* 상단 패딩만 safe-area로 지정하고 고정 높이 44px 부여 */
  padding-top: env(safe-area-inset-top) !important;
  padding-left: 16px !important;
  padding-right: 16px !important;
  padding-bottom: 0 !important;
  height: calc(44px + env(safe-area-inset-top)) !important;
  min-height: unset !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  border-bottom: 1px solid #eeeeee;
  background-color: rgba(255, 255, 255, 0.98);
}

.terms-header h1 {
  position: absolute;
  left: 50%;
  /* 44px 높이의 중앙 위치 */
  top: calc(env(safe-area-inset-top) + 22px) !important;
  bottom: auto !important;
  margin: 0;
  transform: translate(-50%, -50%);
  color: #111111;
  font-size: 17px;
  font-weight: 700;
  white-space: nowrap;
}

.back-button {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  margin-top: 0 !important;
}

.back-button img {
  width: 22px;
  height: 22px;
  display: block;
}

.header-space {
  width: 32px;
  height: 32px;
  margin-top: 0 !important;
}

/* =========================
   약관 소개
========================= */

.terms-intro {
  padding: 16px 20px 20px;
  border-bottom: 8px solid #f6f6f6;
}

.terms-intro h2 {
  margin: 0 0 10px;
  color: #222222;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.4;
}

.terms-intro p {
  margin: 0 0 16px;
  color: #666666;
  font-size: 14px;
  line-height: 1.65;
  word-break: keep-all;
}

.effective-date {
  color: #999999;
  font-size: 12px;
}

/* =========================
   약관 목록
========================= */

.terms-list {
  background-color: #ffffff;
}

.terms-item {
  border-bottom: 1px solid #eeeeee;
}

.terms-title-button {
  width: 100%;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border: none;
  background-color: #ffffff;
  color: #222222;
  font-size: 15px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.terms-title-button:active {
  background-color: #f8fafa;
}

.terms-arrow {
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  margin-right: 3px;
  border-right: 1.5px solid #777777;
  border-bottom: 1.5px solid #777777;
  transform: rotate(45deg);
  transition: transform 0.2s ease;
}

.terms-item.open .terms-arrow {
  transform: rotate(225deg);
}

/* =========================
   약관 상세 내용
========================= */

.terms-content {
  display: none;
  padding: 0 20px 22px;
  color: #555555;
  font-size: 14px;
  line-height: 1.75;
  word-break: keep-all;
}

.terms-item.open .terms-content {
  display: block;
}

.terms-content p {
  margin: 0 0 12px;
}

.terms-content p:last-child {
  margin-bottom: 0;
}

.terms-content ol,
.terms-content ul {
  margin: 0;
  padding-left: 21px;
}

.terms-content li {
  margin-bottom: 8px;
  padding-left: 3px;
}

.terms-content li:last-child {
  margin-bottom: 0;
}

.terms-notice {
  margin-top: 16px !important;
  padding: 14px;
  border-radius: 10px;
  background-color: #edf7f7;
  color: #3f8584;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.65;
}

/* =========================
   하단
========================= */

.terms-footer {
  padding: 28px 20px calc(40px + env(safe-area-inset-bottom));
  background-color: #f7f7f7;
}

.terms-footer p {
  margin: 0;
  color: #999999;
  font-size: 12px;
  line-height: 1.6;
}

/* =========================
   PC / 태블릿
========================= */

@media (min-width: 480px) {
  body {
    background-color: #f2f3f6;
  }

  .terms-screen {
    max-width: 430px;
    min-height: 100vh;
    margin: 0 auto;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.08);
  }
}