/* ============================================
   Daisy Design System — 플랫 다크 테마
   그라데이션/글로우 금지. 단색 + 보더 + 여백으로만 위계 표현.
   ============================================ */

:root {
  --bg: #222222;
  --surface: #2b2b2e;
  --surface-2: #333336;
  --surface-3: #3c3c40;
  --border: #3a3a3e;
  --border-strong: #4a4a4f;

  --text: #f2f2f2;
  --text-dim: #a8a8ad;
  --text-faint: #77777c;

  --accent: #FFA178;
  --accent-strong: #e8906a;
  --on-accent: #1a1a1a;

  --danger: #e5484d;
  --success: #46a758;

  --radius: 6px;
  --radius-sm: 4px;
  --radius-full: 999px;

  --nav-h: 56px;
  --bottom-nav-h: 68px;
}

/* ---------- 페이지 골격 ---------- */
.ds-page {
  padding: calc(var(--nav-h) + 16px) 16px calc(var(--bottom-nav-h) + 32px);
  max-width: 37.5rem;
  margin: 0 auto;
}

.ds-page--flush {
  padding-left: 0;
  padding-right: 0;
}

/* 상단 헤더 (뒤로가기 + 제목 + 우측 액션) */
.ds-header {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 37.5rem;
  height: var(--nav-h);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  z-index: 1000;
}

.ds-header-title {
  flex: 1;
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}

.ds-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* 아이콘 버튼 */
.ds-icon-btn {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text);
  cursor: pointer;
  padding: 0;
  text-decoration: none;
}

.ds-icon-btn:hover { background: var(--surface); }
.ds-icon-btn svg { display: block; }
.ds-icon-btn img { width: 22px; height: 22px; display: block; }

/* ---------- 버튼 ---------- */
.ds-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.ds-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.ds-btn--primary { background: var(--accent); color: var(--on-accent); }
.ds-btn--primary:hover { background: var(--accent-strong); }

.ds-btn--secondary {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border-strong);
}
.ds-btn--secondary:hover { background: var(--surface-3); }

.ds-btn--ghost { background: transparent; color: var(--text-dim); }
.ds-btn--ghost:hover { background: var(--surface); color: var(--text); }

.ds-btn--danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.ds-btn--danger:hover { background: rgba(229, 72, 77, 0.12); }

.ds-btn--block { display: flex; width: 100%; }
.ds-btn--sm { padding: 8px 12px; font-size: 13px; }
.ds-btn--lg { padding: 15px 22px; font-size: 16px; }

/* ---------- 폼 ---------- */
.ds-field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; }

.ds-label { font-size: 13px; font-weight: 700; color: var(--text-dim); }
.ds-label .req { color: var(--accent); }

.ds-input,
.ds-textarea,
.ds-select {
  width: 100%;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
}

.ds-input::placeholder,
.ds-textarea::placeholder { color: var(--text-faint); }

.ds-input:focus,
.ds-textarea:focus,
.ds-select:focus {
  outline: none;
  border-color: var(--accent);
}

.ds-textarea { resize: vertical; min-height: 96px; line-height: 1.55; }

.ds-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23a8a8ad' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 38px;
}

.ds-hint { font-size: 12px; color: var(--text-faint); line-height: 1.5; }
.ds-error-text { font-size: 13px; color: var(--danger); }

.ds-input.is-error,
.ds-textarea.is-error { border-color: var(--danger); }

/* 인라인 알림 박스 */
.ds-alert {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  line-height: 1.5;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  margin-bottom: 14px;
}

.ds-alert--error { border-color: var(--danger); color: var(--danger); background: rgba(229, 72, 77, 0.08); }
.ds-alert--success { border-color: var(--success); color: var(--success); background: rgba(70, 167, 88, 0.08); }

/* ---------- 카드 / 리스트 ---------- */
.ds-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.ds-card--flat { border: none; }

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

.ds-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
}

.ds-list-item:hover { background: var(--surface-2); }

.ds-list-item .body { flex: 1; min-width: 0; }
.ds-list-item .title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ds-list-item .sub {
  font-size: 13px;
  color: var(--text-dim);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- 아바타 ---------- */
.ds-avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  object-fit: cover;
  background: var(--surface-2);
  flex-shrink: 0;
}

.ds-avatar--lg { width: 76px; height: 76px; }
.ds-avatar--xl { width: 96px; height: 96px; }
.ds-avatar--sq { border-radius: var(--radius-sm); }

/* ---------- 칩 / 태그 ---------- */
.ds-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 13px;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.ds-chip:hover { color: var(--text); border-color: var(--border-strong); }
.ds-chip.is-active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 700; }

.ds-chip-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- 세그먼트 탭 ---------- */
.ds-tabbar {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px;
  gap: 4px;
}

.ds-tabbar button,
.ds-tabbar a {
  flex: 1;
  padding: 9px 4px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 14px;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
}

.ds-tabbar button.active,
.ds-tabbar a.active {
  background: var(--surface-3);
  color: var(--accent);
  font-weight: 700;
}

/* ---------- 섹션 ---------- */
.ds-section { margin-bottom: 28px; }

.ds-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 12px;
}

.ds-section-title .more {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-faint);
  text-decoration: none;
}

/* ---------- 구분선 ---------- */
.ds-divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* ---------- 빈 상태 ---------- */
.ds-empty {
  padding: 48px 20px;
  text-align: center;
  color: var(--text-faint);
  font-size: 14px;
  line-height: 1.6;
}

.ds-empty strong { display: block; color: var(--text-dim); font-size: 15px; margin-bottom: 6px; }

/* ---------- 바텀시트 ---------- */
.ds-sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1090;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.ds-sheet-overlay.show { opacity: 1; pointer-events: auto; }

.ds-sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%) translateY(100%);
  width: 100%;
  max-width: 37.5rem;
  max-height: 85vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  z-index: 1100;
  transition: transform 0.28s ease;
  padding: 8px 16px calc(16px + env(safe-area-inset-bottom));
}

.ds-sheet.show { transform: translateX(-50%) translateY(0); }

.ds-sheet-handle {
  width: 44px;
  height: 4px;
  border-radius: var(--radius-full);
  background: var(--border-strong);
  margin: 6px auto 14px;
}

.ds-sheet-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 14px;
}

/* ---------- 그리드 (캐릭터 카드) ---------- */
.ds-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.ds-char-card {
  position: relative;
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
}

.ds-char-card:hover { border-color: var(--border-strong); }

.ds-char-card img.thumb {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  display: block;
  background: var(--surface-2);
}

.ds-char-card .meta { padding: 10px 12px 12px; }

.ds-char-card .name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ds-char-card .desc {
  font-size: 12px;
  color: var(--text-dim);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.45;
}

.ds-char-card .stats {
  display: flex;
  gap: 10px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-faint);
}

/* ---------- 히어로 배너 (메인 페이지 디자인 언어) ----------
   메인의 RANKING/CATEGORY 배너와 동일한 그라데이션 + 시그니처 섀도 +
   큰 영문 타이틀(흰 취소선 악센트 .tr/.rect) 구성. */
.ds-hero {
  position: relative;
  width: 100%;
  max-width: 37.5rem;
  margin: var(--nav-h) auto 0;
  padding: 14px 20px 18px;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
}

.ds-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #B24A4780 0%, #FFA17880 45%, #99614820 100%);
}

.ds-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("/static/images/ui/Banner_signature_shadow.svg");
  background-repeat: no-repeat;
  background-position: right center;
  background-size: auto 100%;
  pointer-events: none;
}

.ds-hero > * { position: relative; z-index: 1; }

.ds-hero-title {
  font-family: 'Pretendard-Regular', sans-serif;
  font-weight: 400;
  font-size: 34px;
  color: #ffffff;
  margin: 0;
}

.ds-hero-title .tr { position: relative; display: inline-block; }

.ds-hero-title .rect {
  background: #ffffff;
  width: 100%;
  height: 4px;
  position: absolute;
  left: 0;
  top: 44%;
}

.ds-hero-sub {
  margin: 8px 0 0;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.88);
  white-space: normal;
}

/* 배너 안 컨트롤(검색바/셀렉트 등) */
.ds-hero-actions { display: flex; gap: 10px; margin-top: 14px; }

/* 배너 안 반투명 칩 (메인 카테고리 탭과 동일) */
.ds-hero-chips {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  margin-right: -20px; /* 화면 끝까지 스크롤 */
}

.ds-hero-chip-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.ds-hero-chip-row::-webkit-scrollbar { display: none; }

.ds-hero .ds-chip {
  flex: 0 0 auto;
  border-radius: var(--radius-full);
  background: rgba(0, 0, 0, 0.28);
  border-color: rgba(255, 255, 255, 0.55);
  color: #ffffff;
}

.ds-hero .ds-chip:hover { border-color: rgba(255, 255, 255, 0.9); color: #ffffff; }

.ds-hero .ds-chip.is-active {
  background: #ffffff;
  border-color: #ffffff;
  color: #1a1a1a;
  font-weight: 700;
}

/* 배너 안 큰 수치(코인 잔액 등) */
.ds-hero-stat { margin-top: 12px; }
.ds-hero-stat .label { font-size: 12px; color: rgba(255, 255, 255, 0.8); display: block; }
.ds-hero-stat .value {
  font-family: 'Pretendard-Bold', sans-serif;
  font-size: 32px;
  color: #ffffff;
  line-height: 1.2;
}

/* 히어로 배너 아래에 오는 페이지 본문: 상단 여백 축소 */
.ds-page--with-hero { padding-top: 18px; }

/* 투톤 영문 섹션 타이틀 (메인 grid-title 감성) */
.ds-section-title .accent { color: var(--accent); }

/* ---------- 행 유틸 ---------- */
.ds-row { display: flex; align-items: center; gap: 10px; }
.ds-row--between { justify-content: space-between; }
.ds-grow { flex: 1; min-width: 0; }

/* ---------- 배지 ---------- */
.ds-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 700;
  background: var(--surface-3);
  color: var(--text-dim);
}

.ds-badge--accent { background: var(--accent); color: var(--on-accent); }
