/* Reset & Base */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background-color: #000000;
  color: #ffffff;
  line-height: 1.5;
  min-width: 280px;
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
}

ul, ol {
  list-style: none;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Header */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background-color: #000000;
  border-bottom: 1px solid #1a1a1a;
}

.header__back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  transition: background-color 0.2s ease;
}

.header__back:hover {
  background-color: #1a1a1a;
}

.header__back:active {
  background-color: #2a2a2a;
}

.header__title {
  font-size: 18px;
  font-weight: 600;
}

.header__spacer {
  width: 40px;
}

/* Main */
.main {
  padding: 16px;
  padding-bottom: 88px; /* 플로팅배너와 88px 간격 */
}

/* 좌우 여백없이 전체 폭 적용 유틸리티 */
.full-width {
  margin-left: -16px;
  margin-right: -16px;
  width: calc(100% + 32px);
}

/* Section */
.section {
  margin-bottom: 24px;
}

.section__title {
  font-size: 14px;
  font-weight: 600;
  color: #888888;
  margin-top: 50px;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* List */
.list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* List Item */
.list-item {
  display: flex;
  align-items: center;
  padding: 12px;
  background-color: #111111;
  border-radius: 12px;
  transition: background-color 0.2s ease, transform 0.1s ease;
  cursor: pointer;
}

.list-item:hover {
  background-color: #1a1a1a;
}

.list-item:active {
  background-color: #222222;
  transform: scale(0.98);
}

.list-item__image {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  overflow: hidden;
  flex-shrink: 0;
  background-color: #1a1a1a;
}

.list-item__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.list-item__content {
  flex: 1;
  margin-left: 12px;
  min-width: 0;
}

.list-item__name {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-item__description {
  font-size: 13px;
  color: #888888;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-item__arrow {
  flex-shrink: 0;
  margin-left: 8px;
  color: #555555;
}

/* List Item - Banner Style (이미지만 표시) */
.list-item--banner {
  padding: 0;
  background-color: #121212;
  border: 2px solid #2a2a2a;
  border-radius: 12px;
  overflow: hidden;
}

.list-item--banner img {
  width: 100%;
  height: auto;
  display: block;
}

.list-item--banner:hover {
  background-color: transparent;
  opacity: 0.9;
}

.list-item--banner:active {
  background-color: transparent;
  opacity: 0.8;
}

/* Carousel */
.carousel {
  position: relative;
  margin: 16px 0;
}

.carousel__viewport {
  border-radius: 12px;
  overflow: hidden;
}

.carousel__track {
  display: flex;
  transition: transform 0.3s ease-out;
  will-change: transform;
}

.carousel__slide {
  flex: 0 0 100%;
  min-width: 0;
}

.carousel__slide a {
  display: block;
}

.carousel__slide img {
  width: 100%;
  height: auto;
}

.carousel__indicators {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 12px;
}

.carousel__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #4E5968;
  transition: background-color 0.2s ease, transform 0.2s ease;
  cursor: pointer;
}

.carousel__dot.active {
  background-color: #2DD4BF;
  transform: scale(1.2);
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Modal Sheet (Bottom Sheet) */
.modal-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: #1a1a1a;
  border-radius: 20px 20px 0 0;
  z-index: 1001;
  transform: translateY(100%);
  transition: transform 0.3s ease;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.modal-overlay.active .modal-sheet {
  transform: translateY(0);
}

.modal-sheet__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
}

.modal-sheet__title {
  font-size: 18px;
  font-weight: 600;
}

.modal-sheet__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 0;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  outline: none !important;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  -webkit-tap-highlight-color: transparent;
}

.modal-sheet__close:hover {
  opacity: 0.7;
}

.modal-sheet__header-spacer {
  width: 24px;
}

.modal-sheet__content {
  padding: 20px;
  padding-top: 0;
  overflow-y: auto;
  flex: 1;
  text-align: center;
}

.modal-sheet__footer {
  padding: 16px 20px;
  padding-bottom: max(32px, calc(env(safe-area-inset-bottom) + 16px));
}

/* Modal Content */
.modal-icon {
  margin-bottom: 20px;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 8px;
}

.modal-subtitle {
  font-size: 14px;
  font-weight: 500;
  color: #ffffff;
  margin-bottom: 16px;
}

.modal-description {
  font-size: 13px;
  color: #999999;
  line-height: 1.7;
  margin-bottom: 24px;
  text-align: center;
}

.text-highlight {
  color: #2DD4BF;
}

/* Checkbox */
.checkbox-label {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
}

.checkbox {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.checkbox-custom {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border: 2px solid #555555;
  border-radius: 6px;
  margin-right: 12px;
  transition: all 0.2s ease;
  position: relative;
}

.checkbox:checked + .checkbox-custom {
  background-color: #2DD4BF;
  border-color: #2DD4BF;
}

.checkbox:checked + .checkbox-custom::after {
  content: '';
  position: absolute;
  left: 6px;
  top: 2px;
  width: 6px;
  height: 12px;
  border: solid #ffffff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.checkbox-text {
  font-size: 14px;
  color: #cccccc;
  line-height: 1.5;
}

/* Button */
.btn {
  display: block;
  width: 100%;
  padding: 16px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  transition: all 0.2s ease;
}

.btn--primary {
  background-color: #2DD4BF;
  color: #000000;
  font-weight: 700;
}

.btn--primary:hover:not(:disabled) {
  background-color: #14b8a6;
}

.btn--primary:active:not(:disabled) {
  background-color: #0d9488;
  transform: scale(0.98);
}

.btn--primary:disabled {
  background-color: #333333;
  color: #666666;
  cursor: not-allowed;
}

/* Openmarket List */
.openmarket-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Ad Carousel Wrapper (오픈마켓 사이 광고) */
.ad-carousel-wrapper {
  list-style: none;
  margin: 8px 0;
}

.ad-carousel-wrapper .carousel {
  margin: 0;
}

/* Responsive Design */

/* 폴드폰 최소 (280px) */
@media (max-width: 320px) {
  html {
    font-size: 14px;
  }

  .header {
    padding: 10px 12px;
  }

  .main {
    padding: 12px;
    padding-bottom: 88px; /* 플로팅배너와 88px 간격 */
  }

  .list-item {
    padding: 10px;
  }

  .list-item__image {
    width: 40px;
    height: 40px;
  }

  .list-item__name {
    font-size: 14px;
  }

  .list-item__description {
    font-size: 12px;
  }

  .modal-sheet__content {
    padding: 16px;
  }

  .warning-box {
    padding: 12px;
  }

  .warning-box__text {
    font-size: 13px;
  }

  .warning-box__list {
    font-size: 12px;
  }

  .checkbox-text {
    font-size: 13px;
  }

  /* 폴드폰에서 플로팅배너 높이 조정 */
  .floating-banner {
    height: 56px;
    bottom: 0; /* 화면 맨 아래 붙임 */
  }
}

/* 일반 모바일 (375px+) */
@media (min-width: 375px) {
  .list-item__image {
    width: 52px;
    height: 52px;
  }
}

/* 태블릿 이상 (768px+) */
@media (min-width: 768px) {
  .main {
    max-width: 600px;
    margin: 0 auto;
    padding: 12px;
    padding-bottom: 90px; /* PC에서는 플로팅배너 영역만 확보 */
  }

  .header {
    max-width: 600px;
    margin: 0 auto;
  }

  .section {
    margin-bottom: 16px;
  }

  .list {
    gap: 12px;
  }

  .openmarket-list {
    gap: 12px;
  }

  .list-item {
    padding: 12px;
  }

  .list-item--banner {
    border-radius: 8px;
  }

  .list-item--banner img {
    max-height: 80px;
    object-fit: cover;
  }

  .list-item__image {
    width: 56px;
    height: 56px;
  }

  .modal-sheet {
    max-width: 500px;
    left: 50%;
    transform: translateX(-50%) translateY(100%);
    border-radius: 20px;
    margin-bottom: 20px;
  }

  .modal-overlay.active .modal-sheet {
    transform: translateX(-50%) translateY(0);
  }

  /* 태블릿에서는 일반 배너로 변경 (화면 안에 표시) */
  .floating-banner {
    position: relative; /* fixed → relative로 변경 */
    bottom: auto;
    left: auto;
    right: auto;
    width: 100%;
    max-width: 600px; /* 메인 컨텐츠와 동일한 폭 */
    margin: 16px auto 0 auto; /* 상단 여백 + 중앙 정렬 */
    transform: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  }

  /* PC: 1x 숨기고 3x만 표시 */
  .floating-banner__mobile {
    display: none;
  }

  .floating-banner__desktop {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
}

/* 접근성: 모션 감소 선호 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .carousel__track {
    transition: none;
  }
}

/* 고대비 모드 지원 */
@media (prefers-contrast: high) {
  .list-item {
    border: 1px solid #ffffff;
  }

  .warning-box {
    border: 2px solid #ff6b6b;
  }
}

/* 하단 플로팅배너 (화면 전체 폭으로 꽉 참) */
.floating-banner {
  position: fixed;
  bottom: 0; /* 화면 맨 아래 붙임 */
  left: 0;
  right: 0;
  width: 100%;
  height: 66px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #111111;
  border-radius: 0; /* 하단 모서리 제거 */
  overflow: hidden;
  z-index: 1002;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.3);
}

.floating-banner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.floating-banner a {
  display: block;
  width: 100%;
  height: 100%;
}

/* 모바일: 1x 이미지만 표시, 3x 숨김 */
.floating-banner__mobile {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.floating-banner__desktop {
  display: none;
}
