:root {
  --bg-main: #fff6f7;
  --bg-soft: #fffafa;

  --panel: rgba(255, 255, 255, 0.85);
  --panel-solid: #ffffff;
  --card: #ffffff;

  --line: #ffd6dd;
  --line-strong: #ffb3bf;

  --headbar-1: #ff9aa8;
  --headbar-2: #ff7d94;

  --text-main: #7a5c60;
  --text-sub: #a4878b;
  --text-light: #c2a9ad;

  --accent: #ff8fa3;
  --accent-soft: #ffe4e8;

  --shadow: 0 4px 10px rgba(255, 150, 160, 0.12);

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;

  --max-width: 1240px;
}

* { box-sizing: border-box; }

html { font-size: 16px; }

body {
  margin: 0;
  font-family: "Nunito", "Arial Rounded MT Bold", sans-serif;
  color: var(--text-main);
  line-height: 1.45;

  /* ★ 이 두 줄을 꼭 추가해 주세요! 배경이 하얀색 도화지 뒤로 숨는 것을 막아줍니다. */
  position: relative;
  z-index: 0; 
}

body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1; /* 이제 body 뒤, 도화지 앞의 정확한 위치에 안착합니다 */
  
  background-image: url('https://sweetdaysinfo.com/wp-content/uploads/2026/03/HSD_wallpaper_250311_00.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  
  background-color: rgba(255, 246, 247, 0.7);
  background-blend-mode: overlay;
  pointer-events: none; /* ★ 클릭 방해 방지용으로 안전하게 추가 */
}

body.modal-open {
  position: fixed;
  overflow: hidden;
  width: 100%;
  left: 0;
  right: 0;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button, input, select { font: inherit; }

.page {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 18px 16px 48px;
}

/* =========================================
   1. 헤더 (로고 및 서브타이틀)
========================================= */
.site-header {
  text-align: center;
  padding: 15px 0 20px 0;
  margin-bottom: 14px;
}

.site-logo-img {
  display: block;
  height: 200px;
  width: auto;
  margin: 0 auto 10px auto;
  object-fit: contain;
}

.site-logo {
  font-size: 1.6rem;
  font-weight: 600;
  color: #ff8fa3;
  letter-spacing: 0.06em;
}

/* =========================================
   2. 상단 내비게이션 (메뉴)
========================================= */
nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
  margin: 20px 0 30px 0;
  flex-wrap: wrap;
}

nav a {
  text-decoration: none;
  background-color: var(--bg-main, #ffe6f0);
  color: #a4878b;
  font-weight: 700;
  font-size: 1rem;
  padding: 12px 24px;
  border-radius: 30px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
  border: 2px solid transparent;
}

nav a:hover {
  background-color: var(--accent, #ff8da1);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(255, 141, 161, 0.3);
}

nav a.active {
  background-color: var(--accent, #ff8da1);
  color: white;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,0.1);
}

/* =========================================
   3. 검색 패널 및 필터 
========================================= */
.search-panel {
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid #f8e3e7;
  border-radius: 22px;
  padding: 14px;
  margin-bottom: 18px;
  box-shadow: none;
  display: flex;
  flex-direction: column; /* 기본(모바일)은 세로로 */
  align-items: center;
}

.search-box {
  display: flex;
  align-items: center;
  background: white;
  border: 1px solid #ffc4ce;
  border-radius: 25px;
  overflow: hidden;
  height: 42px;
  width: 100%;
}

.search-box .input {
  border: none;
  background: transparent;
  outline: none;
  flex: 1;
  padding: 0 15px;
  height: 100%;
  margin: 0;
}

.search-submit-btn {
  background: #ffc4ce;
  border: none;
  padding: 0 12px;
  height: 100%;
  cursor: pointer;
}

.search-box .input:focus,
.search-box .input:active {
  outline: none;
  box-shadow: none;
  border: none;
  -webkit-appearance: none;
  appearance: none;
}

.input, .select {
  width: 100%;
  height: 42px;
  padding: 0 14px;
  border: 1px solid #ffd6dd;
  border-radius: 999px;
  background: #ffffff;
  color: #8c6f73;
  outline: none;
}

.input::placeholder { color: #b79ba0; opacity: 1; }
.input:focus, .select:focus {
  border-color: #ff9aa8;
  box-shadow: 0 0 0 3px rgba(255, 154, 168, 0.14);
}

/* 필터 그룹 (펼침 상태) */
.collapsible-filters { margin-top: 0; }
#themeFilters, #itemFilters {
  display: flex;
  width: 100%;
}
#themeFilters.open, #itemFilters.open {
  display: flex;
  flex-direction: column;
  width: 100%;
  gap: 8px;
  animation: slideDown 0.3s ease-out;
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.view-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 14px;
  padding: 0 4px;
}

.view-controls-left,
.view-controls-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.view-control-btn {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid #ffc4ce;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: #8c6f73;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.view-control-btn.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

/* =========================================
   4. 카드 그리드 (테마, 아이템)
========================================= */
.list-panel {
  background: rgba(255,255,255,0.22);
  border: 1px solid rgba(255,255,255,0.32);
  border-radius: var(--radius-lg);
  padding: 14px;
}

.theme-grid, .item-grid { display: grid; gap: 16px; }
.theme-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.item-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }

.theme-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.theme-list-row {
  display: block;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #ffd6dd;
  border-radius: 14px;
  font-weight: 700;
  color: var(--text-main);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.theme-list-row:hover {
  transform: translateY(-1px);
  background: #ffffff;
  box-shadow: 0 8px 16px rgba(255, 141, 161, 0.12);
}

/* 테마 카드 */
.theme-card {
  background: #ffffff;
  border: 1px solid #ffd6dd;
  border-radius: 12px;
}
.theme-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(162, 91, 189, 0.16);
}
.theme-thumb-wrap {
  background: transparent;
  padding: 0;
  border-radius: 6px 6px 0 0;
  overflow: hidden;
}
.theme-card.theme .theme-thumb {
  aspect-ratio: 1 / 1;
  object-fit: cover;
  width: 100%;
  height: auto;
}
.theme-card.event .theme-thumb {
  aspect-ratio: 560 / 300;
  object-fit: cover;
  width: 100%;
  height: auto;
}
.theme-body { padding: 8px 10px 10px; }
.theme-title { margin: 0; font-size: 0.98rem; line-height: 1.35; color: var(--text-main); }
.theme-meta { margin-top: 6px; font-size: 0.78rem; color: var(--text-sub); }

/* 아이템 카드 */
.item-card {
  background: #ffffff;
  border: 1px solid #ffe1e6;
  border-radius: 10px;
}
.item-thumb-wrap {
  position: relative; /* 뱃지를 띄우기 위해 유지 */
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #f1f1f1;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 8px;
}
/* 2. 썸네일 이미지: 잘림 방지 */
.item-thumb { 
  width: 100%; 
  height: 100%; 
  /* ★ cover를 contain으로 변경하세요! 이렇게 하면 이미지가 잘리지 않고 상자 안에 온전히 다 보입니다. */
  object-fit: contain; 
}

/* 3. 뱃지 스타일은 그대로 둡니다 */
.item-select-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 26px;
  height: auto;
  z-index: 2;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.15));
  pointer-events: none;
}
.item-card p, .item-card div[class*="name"], .item-card div[class*="info"] {
  padding-left: 8px;
  padding-right: 8px;
  padding-bottom: 12px;
  box-sizing: border-box;
}

.item-name-row {
  display: flex;
  align-items: flex-start;
  gap: 0px;
  padding-left: 8px;
  padding-right: 8px;
  padding-bottom: 12px;
  box-sizing: border-box;
}

.item-rarity-badge {
  flex: 0 0 auto;
  width: auto;
  height: 1.5rem;
  margin-top: 0.05rem;
  object-fit: contain;
}

/* ★ 공통 아이템 이름 줄바꿈 처리 (PC 버전 기준 여백) ★ */
.item-name {
  margin: 0;
  font-size: 0.76rem;
  color: var(--text-main);
  line-height: 1.35;
  flex: 1 1 auto;
  min-width: 0;
  
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
  word-break: keep-all;
  overflow-wrap: break-word;
}
.item-card .item-sub { display: none; }

/* =========================================
   5. 상세 페이지 (Detail)
========================================= */
.breadcrumb {
  margin-bottom: 12px;
  padding: 8px 10px;
  background: rgba(255,255,255,0.62);
  border: 1px solid #f8e3e7;
  border-radius: 10px;
  font-size: 0.86rem;
  color: #a4878b;
}
.breadcrumb a { color: #f08fa0; font-weight: 700; }

.detail-shell { max-width: 980px; margin: 0 auto; }

.detail-top-card {
  background: rgba(255,255,255,0.7);
  border: 1px solid #e6c0ef;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.detail-top-inner {
  display: grid;
  grid-template-columns: minmax(280px, 42%) 1fr;
  gap: 18px;
  padding: 18px;
  align-items: center;
}
.detail-banner-wrap {
  background: #ffffff;
  border-radius: 8px;
  padding: 6px;
  border: 1px solid #edd3f4;
}
.detail-banner { width: 100%; height: auto; border-radius: 6px; }

.detail-info { display: flex; flex-direction: column; gap: 12px; }
.info-row { display: grid; gap: 6px; }
.info-label {
  display: inline-block;
  padding: 6px 10px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #ffffff;
  background: linear-gradient(90deg, var(--headbar-1), #f9a7b6);
  border-radius: 4px;
}
.info-value { min-height: 22px; padding: 4px 2px; font-size: 1rem; }

.section-block {
  margin-top: 16px;
  background: rgba(255,255,255,0.56);
  border: 1px solid rgba(255,255,255,0.45);
  border-radius: 12px;
  overflow: hidden;
}
.section-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  font-size: 1rem;
  font-weight: 600;
  color: #ab6969;
  border-radius: 8px;
  background: #ffd9de;
}
.section-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
  font-size: 0.95rem;
}
.section-content { padding: 14px; }

/* =========================================
   6. 상태 & 더보기 버튼
========================================= */
.empty, .loading, .error {
  padding: 24px 12px;
  text-align: center;
  border-radius: 10px;
  color: var(--text-sub);
  
  /* ★ 여기서부터 새로 추가된 부분 ★ */
  min-height: 50vh; /* 화면(브라우저 창) 높이의 50%만큼 항상 영역을 확보합니다 */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}


.loading {
background: rgba(240, 73, 95, 0.2); /* 사이트 테마에 어울리는 진한 코코아색 반투명 */
color: #ffffff; /* 로딩 글자를 흰색으로 변경하여 잘 보이게 설정 */
}

.loading-gif {
  display: inline-block;
  width: 60px; /* GIF 크기가 너무 크거나 작으면 이 숫자를 조절하세요 */
  height: auto;
  margin-bottom: 10px;
}

.pagination-slot {
  width: 100%;
}

.pagination-wrap {
  margin: 28px auto 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.pagination-status {
  font-size: 0.92rem;
  color: var(--text-sub);
  font-weight: 700;
}

.pagination-status span {
  font-weight: 500;
  opacity: 0.9;
}

.pagination-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.pagination-btn {
  min-width: 44px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.96);
  color: var(--text-main);
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pagination-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  background: var(--accent-soft);
}

.pagination-btn.is-active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  box-shadow: 0 6px 14px rgba(255, 141, 161, 0.28);
}

.pagination-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.section-content .pagination-wrap {
  margin-top: 18px;
}

.bottom-info {
  margin-top: 32px;
  padding-top: 22px;
  border-top: 1px solid rgba(255, 196, 206, 0.7);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.bottom-info-block {
  background: rgba(255, 255, 255, 0.52);
  border: 1px solid rgba(255, 214, 221, 0.85);
  border-radius: 18px;
  padding: 16px 18px;
}

.bottom-info-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
}

.bottom-info-text {
  margin: 8px 0 0;
  font-size: 0.9rem;
  color: var(--text-sub);
  line-height: 1.5;
  white-space: pre-line;
}

.bottom-text-link {
  display: inline-block;
  margin-top: 10px;
  color: var(--accent);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.store-links-placeholder {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
  align-items: center;
}

.store-placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 120px;
  min-height: 42px;
  padding: 0 14px;
  border: 1px dashed #ffb7c4;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  color: #a4878b;
  font-size: 0.85rem;
  font-weight: 700;
}

.store-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 142px;
  min-height: 56px;
  border-radius: 8px;
  text-decoration: none;
  cursor: pointer;
}

.store-badge-img {
  display: block;
  width: auto;
  height: 56px;
  max-width: 100%;
  object-fit: contain;
}

.store-badge-fallback {
  display: none;
  align-items: center;
  justify-content: center;
  min-width: 142px;
  min-height: 56px;
  padding: 0 14px;
  border: 1px dashed #ffb7c4;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: #a4878b;
  font-size: 0.85rem;
  font-weight: 700;
}

.store-badge.is-missing .store-badge-img {
  display: none;
}

.store-badge.is-missing .store-badge-fallback {
  display: inline-flex;
}

.footer {
  margin-top: 22px;
  text-align: center;
  font-size: 0.6rem;
  color: #ab9d9f;
  line-height: 1.8;
}

/* =========================================
   7. 팝업 (모달)
========================================= */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background-color: rgba(255, 230, 235, 0.7);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(5px);
  animation: fadeIn 0.3s ease;
}
.modal-overlay.open { display: flex; }
.modal-content {
  background-color: #ffffff;
  border: 1px solid var(--line-strong, #ffc4ce);
  border-radius: 20px;
  width: 90%;
  max-width: 450px;
  padding: 30px;
  position: relative;
  box-shadow: 0 10px 25px rgba(255, 141, 161, 0.2);
  animation: slideUpModal 0.3s ease-out;
  text-align: center;
}
.modal-arrow {
  position: absolute; top: 105px; transform: translateY(-50%);
  background: transparent; border: none; font-size: 3rem; color: var(--accent);
  cursor: pointer; z-index: 10; padding: 0 10px;
}
.modal-arrow.prev { left: 10px; }
.modal-arrow.next { right: 10px; }
.modal-close {
  position: absolute; top: 15px; right: 20px; background: transparent;
  border: none; font-size: 1.5rem; color: #8b6e73; cursor: pointer; z-index: 10;
}
.modal-item-visual {
  position: relative;
  width: 150px; height: 150px; margin: 0 auto 15px; background-color: var(--bg-soft);
  border: 1px solid #ffc4ce; border-radius: 12px; display: flex;
  align-items: center; justify-content: center; overflow: hidden;
}
.modal-item-visual img { max-width: 90%; max-height: 90%; object-fit: contain; }
.modal-item-visual .modal-select-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 32px;
  height: auto;
  max-width: none;
  max-height: none;
  z-index: 2;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.15));
  pointer-events: none;
}
.modal-select-options {
  display: flex;
  justify-content: center;
  gap: 8px;
  max-width: 100%;
  margin: -4px auto 14px;
  padding: 2px 2px 8px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: #ffc4ce var(--accent-soft);
}
.modal-select-options::-webkit-scrollbar {
  height: 8px;
}
.modal-select-options::-webkit-scrollbar-track {
  background: var(--accent-soft);
  border-radius: 999px;
}
.modal-select-options::-webkit-scrollbar-thumb {
  background: #ffc4ce;
  border-radius: 999px;
}
.modal-select-options::-webkit-scrollbar-thumb:hover {
  background: #ffb3bf;
}
.modal-select-options[hidden] {
  display: none;
}
.modal-select-option-btn {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  padding: 4px;
  border: 1px solid #ffe1e6;
  border-radius: 8px;
  background: #ffffff;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}
.modal-select-option-btn:hover,
.modal-select-option-btn.is-active {
  border-color: var(--accent);
  background-color: #fff0f2;
  box-shadow: 0 2px 7px rgba(255, 141, 161, 0.22);
}
.modal-select-option-btn img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.modal-item-name { font-size: 1.1rem; font-weight: 700; color: var(--text-main); margin-bottom: 20px; }
.modal-info-section { background-color: rgba(255, 196, 206, 0.2); border-radius: 10px; padding: 15px; }
.modal-info-row { display: flex; justify-content: space-between; align-items: center; width: 100%; }
.modal-info-label { font-size: 0.85rem; color: #8b6e73; font-weight: 700; }
.modal-info-value { text-align: right; padding-left: 10px; }
.modal-set-info {
  margin-top: 15px;
  padding: 12px;
  background-color: #fff0f2;
  border: 1px dashed #ffb7c4;
  border-radius: 12px;
  text-align: left;
  animation: fadeIn 0.3s ease;
}
.modal-set-label {
  font-size: 0.8rem;
  color: #ff7d94;
  font-weight: 800;
  margin-bottom: 8px;
}
.modal-set-content {
  display: flex;
  align-items: center;
  gap: 12px;
}
.modal-set-content img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 8px;
  background-color: #ffffff;
  border: 1px solid #ffe1e6;
}
.modal-set-content div {
  font-size: 0.9rem;
  color: #7a5c60;
  font-weight: 700;
  line-height: 1.3;
}
.modal-btn-wrap { text-align: center; margin-top: 20px; }
.modal-detail-btn {
  background-color: var(--accent); color: white; border: none; padding: 10px 24px;
  border-radius: 25px; font-size: 0.9rem; font-weight: 700; cursor: pointer;
  box-shadow: 0 4px 10px rgba(255, 141, 161, 0.3); transition: all 0.2s ease;
}
.modal-detail-btn:hover { background-color: #ff7d94; transform: translateY(-2px); }

/* =========================================
   8. 반응형 (Media Queries) - 통합 관리
========================================= */

/* 태블릿 (1100px 이하) */
@media (max-width: 1100px) {
  .theme-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .item-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

/* PC 버전 전용 (769px 이상) */
@media (min-width: 769px) {
  .search-panel {
    flex-direction: row;
    justify-content: center;
    padding: 15px 20px;
    gap: 10px;
  }
  .search-box { width: 500px; flex: none; }
  .select { width: 200px; flex: none; }
  #themeFilters, #itemFilters {
    display: flex;
    width: auto;
    flex: none;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
  }

  .search-panel .custom-dropdown {
    width: 220px;
    min-width: 180px;
    max-width: 220px;
    margin: 0;
  }
}

/* =========================================
   [수정] 모바일 가로 스크롤 방지 및 카드 규격 완벽 통일
========================================= */
body, html {
    overflow-x: hidden; 
}

/* 모바일 전용 (768px 이하) */
@media (max-width: 768px) {
  .page { padding: 14px 10px 32px; }
  .site-logo-img { height: 100px; }

  .bottom-info {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 24px;
    padding-top: 18px;
  }

  .bottom-info-block {
    padding: 14px 14px 15px;
  }

  .bottom-info-title {
    font-size: 0.95rem;
  }

  .bottom-info-text {
    font-size: 0.85rem;
  }

  .store-links-placeholder {
    flex-wrap: nowrap;
    gap: 8px;
  }

  .store-badge {
    width: calc((100% - 8px) / 2);
    min-width: 0;
  }

  .store-badge-img {
    width: 100%;
    height: auto;
    max-height: 48px;
  }

  .store-badge-fallback {
    width: 100%;
    min-width: 0;
  }

  .search-panel {
    gap: 10px;
  }

  #themeFilters,
  #itemFilters {
    display: grid;
    gap: 8px;
    margin-top: 0;
  }

  #themeFilters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  #itemFilters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .custom-dropdown {
    width: 100%;
    min-width: 0;
    max-width: none;
    margin: 0;
  }

  .dropdown-header {
    padding: 10px 8px;
    font-size: 0.78rem;
    line-height: 1.2;
  }

  .view-controls {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .view-controls-left,
  .view-controls-right {
    flex-wrap: wrap;
  }

  .pagination-wrap {
    margin-top: 22px;
    gap: 10px;
  }

  .pagination-controls {
    gap: 6px;
  }

  .pagination-btn {
    min-width: 40px;
    padding: 9px 12px;
    font-size: 0.88rem;
  }
  
  .theme-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  
  /* 아이템 그리드 모바일 규격 고정 */
  .item-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    padding: 5px;
    width: 100%;
    box-sizing: border-box;
  }
  
  .item-card { 
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    padding: 4px;
    border-radius: 8px; 
    box-sizing: border-box;
  }
  
  .item-thumb-wrap { 
    position: relative; /* ★ 뱃지를 띄우기 위해 필수! */
    width: 100%;
    aspect-ratio: 1 / 1;
    height: auto;
    margin: 0 auto 4px;
    border-radius: 6px; 
  }

  .item-select-badge {
    position: absolute;
    top: 5px;
    left: 5px;
    width: 18px;
    height: auto;
    z-index: 2;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.15));
    pointer-events: none;
  }

  /* ★ 모바일 아이템 이름 전용 설정 (위쪽 정렬 + 2줄 말줄임) ★ */
  .item-name {
    width: 100%;
    font-size: 10px;
    line-height: 1.3;
    flex: none;
    display: block;
    max-height: 2.6em;
    text-align: left;
  }

  .item-name.no-rarity {
    -webkit-line-clamp: 3;
    max-height: 3.9em;
  }

  .item-name-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 0 2px;
    gap: 2px;
  }

  .item-name-row.no-rarity {
    gap: 0;
  }

  .item-rarity-badge {
    height: 18px;
    position: static;
    margin-top: 0;
  }

  .detail-top-inner { grid-template-columns: 44% 1fr; padding: 10px; gap: 10px; }
  .detail-banner-wrap { padding: 4px; }
  .detail-info { gap: 10px; }
  .info-row { gap: 4px; }
  .info-label { padding: 6px 10px; font-size: 0.78rem; }
  .info-value { padding: 2px 2px 0; font-size: 0.9rem; }
  
  .modal-content { padding: 20px; }
  .modal-arrow { font-size: 2.5rem; top: 80px; }
  .modal-item-visual { width: 120px; height: 120px; }
  .modal-item-visual .modal-select-badge {
    top: 7px;
    left: 7px;
    width: 24px;
  }
  .modal-select-options {
    gap: 6px;
    margin-bottom: 12px;
    padding-bottom: 7px;
  }
  .modal-select-option-btn {
    width: 42px;
    height: 42px;
    padding: 3px;
    border-radius: 7px;
  }
  .modal-set-content {
    gap: 10px;
  }
  .modal-set-content img {
    width: 42px;
    height: 42px;
  }
  .modal-set-content div {
    font-size: 0.85rem;
  }
}

/* 아주 작은 화면 */
@media (max-width: 480px) {
  html { font-size: 15px; }

  .item-select-badge {
    width: 16px;
  }

  .modal-item-visual .modal-select-badge {
    width: 22px;
  }

  .pagination-status {
    font-size: 0.84rem;
    text-align: center;
  }

  .pagination-btn {
    min-width: 36px;
    padding: 8px 10px;
  }
}

/* =========================================
   [수정] 체크박스 드롭다운 스타일
========================================= */
.custom-dropdown {
  position: relative;
  width: 100%;
  min-width: 180px;
  max-width: 220px; /* PC에서 드롭다운 너비 */
  margin: 0 auto;
}

.dropdown-header {
  padding: 10px 15px;
  border: 1px solid #ffc4ce;
  border-radius: 20px;
  background: #ffffff;
  cursor: pointer;
  color: #8c6f73;
  font-weight: 700;
  text-align: center;
  transition: all 0.2s;
}

.dropdown-header:hover {
  background: #fff6f7;
}

.dropdown-list {
  display: none; 
  position: absolute;
  top: 100%;
  left: 0;
  width: max-content; /* ★ 글자 길이에 맞춰서 가로로 자동 확장! */
  min-width: 100%;    /* ★ 그래도 최소한 버튼 크기보다는 작아지지 않게 방어 */
  /* ... 나머지 기존 속성들은 그대로 두세요 ... */
  background: #ffffff;
  border: 1px solid #ffc4ce;
  border-radius: 12px;
  margin-top: 5px;
  max-height: 250px; /* 너무 길면 스크롤 생성 */
  overflow-y: auto;
  z-index: 1000;
  box-shadow: 0 4px 15px rgba(255, 141, 161, 0.15);
  padding: 10px;
  text-align: left;
}

/* JS로 'show' 클래스가 붙으면 짜잔! 하고 나타남 */
.dropdown-list.show {
  display: block;
}

.dropdown-list label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px; /* ★ 여백도 살짝 넓혀주면 더 예쁩니다 */
  cursor: pointer;
  white-space: nowrap; /* ★ 핵심! 글자가 길어도 절대 밑으로 떨어지지 않음 */
  /* ... 기존 속성들 유지 ... */
  font-size: 0.9rem;
  color: #7a5c60;
  border-bottom: 1px solid #fff0f2;
}

.dropdown-list label:last-child {
  border-bottom: none;
}

.dropdown-list label:hover {
  background: #fff6f7;
  border-radius: 6px;
}

/* 드롭다운 내부 아이콘 라벨 스타일 */
.dropdown-list label.icon-label {
  display: flex;
  align-items: center;
  gap: 12px; /* 아이콘과 글자 사이 간격 */
  padding: 10px;
  transition: background 0.2s;
}

/* 드롭다운 안의 작은 아이콘 이미지 */
.dropdown-item-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
  border-radius: 4px;
  background: #fdf2f4; /* 아이콘 배경 살짝 */
}

/* 체크박스가 체크되었을 때 라벨 배경색 강조 (선택됨 표시) */
.dropdown-list label.icon-label:has(input:checked) {
  background: #fff0f2;
  font-weight: bold;
}

@media (max-width: 768px) {
  .page-themes #themeFilters,
  .page-events #themeFilters,
  .page-items #itemFilters {
    display: grid;
    gap: 8px;
    width: 100%;
  }

  .page-themes #themeFilters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .page-events #themeFilters,
  .page-items #itemFilters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .search-panel .custom-dropdown {
    width: 100%;
    min-width: 0;
    max-width: none;
    margin: 0;
  }

  .search-panel .dropdown-header {
    width: 100%;
    padding: 10px 8px;
    font-size: 0.78rem;
    line-height: 1.2;
  }
}
