/**
 * base.css - 기본 스타일 및 CSS 변수 정의
 * 
 * 섹션 구성:
 * 1. 폰트 정의
 * 2. CSS 변수 (색상, 그림자 등)
 * 3. 리셋 및 기본 스타일
 * 4. 레이아웃 기본
 * 5. 버튼 공통 스타일
 * 6. 스크롤바 스타일
 */

/* ============================================
   1. 폰트 정의 (Google Fonts)
   ============================================ */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;500;600;700&display=swap');

/* DeckCaptureFont를 Noto Sans KR Bold로 매핑 */
@font-face {
  font-family: 'DeckCaptureFont';
  src: local('Noto Sans KR Bold'), local('NotoSansKR-Bold');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ============================================
   이미지 드래그 방지
   ============================================ */
img {
  -webkit-user-drag: none;
  -khtml-user-drag: none;
  -moz-user-drag: none;
  -o-user-drag: none;
  user-drag: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  pointer-events: none;
}

/* 클릭 가능한 요소 내 이미지는 부모가 클릭 처리 */
button img, a img, .clickable img, .gift-card img, .pack-card img {
  pointer-events: none;
}

/* ============================================
   2. CSS 변수 정의
   ============================================ */
html, body {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html { 
  scrollbar-gutter: stable; 
}

:root {
  /* 주요 색상 */
  --primary-color: #d4af37;
  --primary-hover: #b8941f;
  --secondary-color: #8b7355;
  
  /* 배경 색상 */
  --dark-bg: #2a2419;
  --light-bg: #1a1612;
  --border-color: #5a4a35;
  
  /* 효과 */
  --card-shadow: 0 4px 12px rgba(0,0,0,0.4);
  
  /* 등급별 색상 */
  --tier-1-color: #a8a8a8;
  --tier-2-color: #4a9eff;
  --tier-3-color: #9b59b6;
  --tier-4-color: #f39c12;
  --tier-EX-color: #ccff00;
  
  /* 강조 색상 */
  --gold-accent: #d4af37;
  --bronze-accent: #8b6f47;
}

/* ============================================
   3. 리셋 및 기본 스타일
   ============================================ */
* {
  box-sizing: border-box;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

html {
  font-size: 16px; /* 기본값 - JS에서 screen.height로 덮어씀 */
  scroll-behavior: smooth;
  overflow-x: auto;
  overflow-y: auto;
}

body {
  font-family: 'Noto Sans KR', sans-serif;
  margin: 0;
  background: linear-gradient(135deg, #1a1612 0%, #2a2419 100%);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 90rem;
  color: #e8dcc4;
}

.container {
  display: flex;
  width: 100%;
  max-width: 100rem;
  min-width: 88rem;
  margin: 0 auto 1.25rem auto;
  background: rgba(26, 22, 18, 0.8);
  box-shadow: 0 0 1.25rem rgba(212, 175, 55, 0.2);
  border-radius: 0.75rem;
  border: 2px solid rgba(139, 111, 71, 0.3);
  overflow: visible;
  flex: 1;
}

/* ============================================
   헤더 (사이트 테마에 맞춘 스타일)
   ============================================ */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(26, 22, 18, 0.98);
  border-bottom: 2px solid rgba(212, 175, 55, 0.4);
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
  width: 100%;
}

.header-content {
  max-width: 100rem;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.5rem;
  font-weight: 700;
  color: #d4af37;
  text-shadow: 0 0 10px rgba(212, 175, 55, 0.4);
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 0.5rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem 1rem;
  background: rgba(42, 36, 25, 0.8);
  border: 2px solid rgba(139, 111, 71, 0.5);
  border-radius: 0.5rem;
  color: #c4b59d;
  font-weight: 500;
  transition: all 0.15s;
  text-decoration: none;
}

.nav-link:hover {
  background: rgba(212, 175, 55, 0.2);
  border-color: #d4af37;
  color: #f5e6d3;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(212, 175, 55, 0.3);
}

.copyright-note {
  text-align: center;
  padding: 1.25rem;
  color: #8b7355;
  font-size: 0.85em;
  line-height: 1.6;
  margin-top: 2.5rem;
  border-top: 1px solid rgba(139, 111, 71, 0.3);
  background: rgba(42, 36, 25, 0.3);
  border-radius: 0.5rem;
}

.copyright-note p {
  margin: 0.2rem 0;
}

.copyright-note p:first-child {
  font-weight: 600;
  color: #a89070;
  margin-bottom: 0.4rem;
}

.copyright-note a {
  color: #d4af37;
  text-decoration: none;
}

.copyright-note a:hover {
  text-decoration: underline;
}

/* ============================================
   5. 버튼 공통 스타일
   ============================================ */
button {
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

button:hover {
  transform: translateY(-1px);
}

button:active {
  transform: translateY(1px);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn {
  padding: 0.625rem 1.25rem;
  border: none;
  border-radius: 0.3125rem;
  font-weight: 600;
  font-size: 0.875rem;
}

.btn.primary {
  background: linear-gradient(135deg, #d4af37 0%, #b8941f 100%);
  color: #1a1612;
  border: 2px solid rgba(212, 175, 55, 0.5);
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.3);
}

.btn.primary:hover {
  background: linear-gradient(135deg, #e6c24d 0%, #d4af37 100%);
  box-shadow: 0 4px 12px rgba(212, 175, 55, 0.4);
}

.btn.secondary {
  background: rgba(139, 115, 85, 0.8);
  color: #f5e6d3;
  border: 2px solid rgba(139, 111, 71, 0.5);
}

.btn.secondary:hover {
  background: rgba(139, 115, 85, 1);
  border-color: var(--bronze-accent);
}

/* ============================================
   6. 스크롤바 스타일
   ============================================ */
::-webkit-scrollbar {
  width: 0.625rem;
  height: 0.625rem;
}

::-webkit-scrollbar-track {
  background: rgba(26, 22, 18, 0.5);
}

::-webkit-scrollbar-thumb {
  background: rgba(139, 111, 71, 0.6);
  border-radius: 0.3125rem;
  border: 2px solid rgba(26, 22, 18, 0.5);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(212, 175, 55, 0.8);
}

/* ============================================
   7. 통합 기프트 카드 (Unified Gift Card)
   모든 곳에서 재사용 가능한 기프트 카드 컴포넌트
   ============================================ */
.unified-gift-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
  background: rgba(42, 36, 25, 0.5);
  border-radius: 0.75rem;
  border: 2px solid rgba(212, 175, 55, 0.2);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(212, 175, 55, 0.1);
}

.unified-gift-card:hover {
  transform: translateY(-4px) scale(1.03);
  border-color: #ffae00;
  box-shadow: 
    0 0 12px rgba(255, 174, 0, 0.5),
    inset 0 0 8px rgba(255, 174, 0, 0.15);
  z-index: 10;
}

.unified-gift-card:hover .ugc-image-container {
  filter: brightness(1.1) drop-shadow(0 0 4px rgba(255, 174, 0, 0.4));
}

/* 합성 기프트도 일반 기프트와 동일한 스타일 사용 */
.unified-gift-card.synthesis {
  /* 특별 스타일 없음 - 일반 기프트와 동일 */
}

/* 등급 배지 */
.ugc-tier-badge {
  position: absolute;
  font-family: 'DeckCaptureFont', sans-serif;
  font-weight: 900;
  color: #ffae00;
  z-index: 2;
  text-shadow: 0 0 5px rgba(255, 174, 0, 0.5), 2px 2px 0px rgba(0, 0, 0, 0.8);
  letter-spacing: -1px;
  background: none;
}

.ugc-tier-badge.tier-EX {
  color: #ccff00;
  text-shadow: 0 0 5px rgba(204, 255, 0, 0.5), 2px 2px 0px rgba(0, 0, 0, 0.8);
}

/* 이미지 컨테이너 */
.ugc-image-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: filter 0.3s ease;
}

.ugc-image-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('../기타/에고기프트_테두리.webp');
  background-size: 100% 100%;
  background-repeat: no-repeat;
  background-position: center;
  pointer-events: none;
  z-index: 0;
}

.ugc-image-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: transparent;
  position: relative;
  z-index: 1;
}

.ugc-image-placeholder img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.ugc-image-placeholder i {
  color: rgba(102, 126, 234, 0.3);
}

/* 속성 아이콘 */
.ugc-attribute-icon {
  position: absolute;
  z-index: 2;
  pointer-events: none;
}

.ugc-attribute-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6));
}

/* 기프트 이름 */
.ugc-name {
  text-align: center;
  width: 100%;
  font-weight: 600;
  color: #333;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: keep-all;
  text-shadow: none;
}

/* 어두운 배경용 (실행 창 등) */
.unified-gift-card.dark-theme .ugc-name {
  color: #f5e6d3;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* 키워드 */
.ugc-keyword {
  display: flex;
  justify-content: center;
  margin-top: 0.25rem;
}

.ugc-keyword span {
  display: inline-block;
  padding: 0.1875rem 0.5rem;
  background: linear-gradient(135deg, rgba(139, 111, 71, 0.9) 0%, rgba(90, 74, 53, 0.9) 100%);
  color: #f5e6d3;
  border-radius: 0.625rem;
  font-weight: 600;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(212, 175, 55, 0.2);
  border: 1px solid rgba(212, 175, 55, 0.3);
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* 합성 배지 - 숨김 처리 */
.ugc-synthesis-badge {
  display: none;
}

/* 추가 배지 (시작, 목표 등) */
.ugc-badge {
  position: absolute;
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  font-weight: bold;
  z-index: 3;
  color: #fff;
}

.ugc-badge.starting {
  background: #4a7c4a;
}

.ugc-badge.general {
  background: #4a6a9c;
}

/* ============================================
   사이즈별 스타일
   ============================================ */

/* Large (기본, 기프트 목록 탭용) */
.unified-gift-card.size-large {
  width: 10rem;
  padding: 0.75rem;
}

.unified-gift-card.size-large .ugc-tier-badge {
  top: -0.5rem;
  left: 0.5rem;
  font-size: 2.375rem;
}

.unified-gift-card.size-large .ugc-image-container {
  width: 8.75rem;
  height: 8.75rem;
}

.unified-gift-card.size-large .ugc-image-placeholder {
  width: 5.625rem;
  height: 5.625rem;
}

.unified-gift-card.size-large .ugc-image-placeholder i {
  font-size: 3em;
}

.unified-gift-card.size-large .ugc-attribute-icon {
  bottom: 0.25rem;
  right: 0.25rem;
  width: 2.25rem;
  height: 2.25rem;
}

.unified-gift-card.size-large .ugc-name {
  padding: 0.625rem 0.3125rem 0;
  font-size: 0.95em;
  height: 3.2em;
  min-height: 3.2em;
}

.unified-gift-card.size-large .ugc-keyword span {
  font-size: 0.75em;
}

.unified-gift-card.size-large .ugc-synthesis-badge {
  top: 0.5rem;
  right: 0.5rem;
  font-size: 1em;
}

.unified-gift-card.size-large .ugc-badge {
  bottom: 0.25rem;
  right: 0.25rem;
  font-size: 0.7em;
}

/* Medium (플래너 목표 기프트, 선택 모달용) */
.unified-gift-card.size-medium {
  width: 6.25rem;
  padding: 0.5rem;
}

.unified-gift-card.size-medium .ugc-tier-badge {
  top: -0.3125rem;
  left: 0.3125rem;
  font-size: 1.5rem;
}

.unified-gift-card.size-medium .ugc-image-container {
  width: 5.3125rem;
  height: 5.3125rem;
}

.unified-gift-card.size-medium .ugc-image-placeholder {
  width: 3.4375rem;
  height: 3.4375rem;
}

.unified-gift-card.size-medium .ugc-image-placeholder i {
  font-size: 2em;
}

.unified-gift-card.size-medium .ugc-attribute-icon {
  bottom: 0.125rem;
  right: 0.125rem;
  width: 1.375rem;
  height: 1.375rem;
}

.unified-gift-card.size-medium .ugc-name {
  padding: 0.375rem 0.1875rem 0;
  font-size: 0.75em;
  height: 3em;
  min-height: 3em;
}

.unified-gift-card.size-medium .ugc-keyword span {
  font-size: 0.65em;
  padding: 0.125rem 0.375rem;
}

.unified-gift-card.size-medium .ugc-synthesis-badge {
  top: 0.3125rem;
  right: 0.3125rem;
  font-size: 0.8em;
}

.unified-gift-card.size-medium .ugc-badge {
  bottom: 0.125rem;
  right: 0.125rem;
  font-size: 0.6em;
}

/* Small (실행 창 전체 목록용) */
.unified-gift-card.size-small {
  width: 4.375rem;
  padding: 0.3125rem;
}

.unified-gift-card.size-small .ugc-tier-badge {
  top: -0.25rem;
  left: 0.1875rem;
  font-size: 1rem;
}

.unified-gift-card.size-small .ugc-image-container {
  width: 3.4375rem;
  height: 3.4375rem;
}

.unified-gift-card.size-small .ugc-image-placeholder {
  width: 2.1875rem;
  height: 2.1875rem;
}

.unified-gift-card.size-small .ugc-image-placeholder i {
  font-size: 1.5em;
}

.unified-gift-card.size-small .ugc-attribute-icon {
  bottom: 0.0625rem;
  right: 0.0625rem;
  width: 1rem;
  height: 1rem;
}

.unified-gift-card.size-small .ugc-name {
  padding: 0.1875rem 0.125rem 0;
  font-size: 0.7em;
  height: 2.8em;
  min-height: 2.8em;
}

.unified-gift-card.size-small .ugc-synthesis-badge {
  top: 0.125rem;
  right: 0.125rem;
  font-size: 0.55em;
}

.unified-gift-card.size-small .ugc-badge {
  bottom: 0.0625rem;
  right: 0.0625rem;
  font-size: 0.5em;
  padding: 0.0625rem 0.1875rem;
}

/* Tiny (획득 순서, 현재 층 목표용) */
.unified-gift-card.size-tiny {
  width: 3.4375rem;
  padding: 0.25rem;
}

.unified-gift-card.size-tiny .ugc-tier-badge {
  top: -0.1875rem;
  left: 0.125rem;
  font-size: 0.8125rem;
}

.unified-gift-card.size-tiny .ugc-image-container {
  width: 2.625rem;
  height: 2.625rem;
}

.unified-gift-card.size-tiny .ugc-image-placeholder {
  width: 1.6875rem;
  height: 1.6875rem;
}

.unified-gift-card.size-tiny .ugc-image-placeholder i {
  font-size: 1.2em;
}

.unified-gift-card.size-tiny .ugc-attribute-icon {
  bottom: 0rem;
  right: 0rem;
  width: 0.75rem;
  height: 0.75rem;
}

.unified-gift-card.size-tiny .ugc-name {
  padding: 0.125rem 0.0625rem 0;
  font-size: 0.6em;
  height: 2.6em;
  min-height: 2.6em;
}

.unified-gift-card.size-tiny .ugc-synthesis-badge {
  top: 0.0625rem;
  right: 0.0625rem;
  font-size: 0.45em;
}

.unified-gift-card.size-tiny .ugc-badge {
  display: none;
}

/* ===================================
   사이드 광고 영역
   =================================== */
/* 광고 미승인 상태 - 승인 후 아래 display: none 제거 */
/* 요청 시 광고칸 다시 보이게 변경 */
.side-ad {
    display: none;
}

.bottom-ad {
    display: none;
}

/* 광고 승인 후 아래 주석 해제 - 요청 시 광고칸 다시 보이게 변경
.side-ad {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 160px;
    min-height: 600px;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
}
*/
.side-ad.left-ad {
    left: 10px;
}

.side-ad.right-ad {
    right: 10px;
}

.ad-placeholder {
    width: 160px;
    height: 600px;
    background: var(--bg-card, rgba(22, 27, 34, 0.8));
    border: 1px dashed var(--border-color, #333);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted, #666);
    font-size: 0.75rem;
}
*/
/* 화면이 충분히 넓을 때만 사이드 광고 표시 */
@media (min-width: 1800px) {
    .side-ad {
        display: flex;
    }
}

/* 사이드 광고 기본 숨김, 넓은 화면에서만 표시 */
@media (max-width: 1799px) {
    .side-ad {
        display: none;
    }
}

/* 푸터 위 가로 광고 */
.bottom-ad {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1.5rem 0;
    margin-top: 2rem;
}

.ad-placeholder-horizontal {
    width: 728px;
    height: 90px;
    max-width: 100%;
    background: var(--bg-card, rgba(22, 27, 34, 0.8));
    border: 1px dashed var(--border-color, #333);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted, #666);
    font-size: 0.75rem;
}
*/

/* 후원하기 버튼 */
.donate-btn {
    background: linear-gradient(135deg, #ff6b6b, #ee5a5a);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: all 0.2s ease;
    margin-left: 1rem;
}

.donate-btn:hover {
    background: linear-gradient(135deg, #ff5252, #e04848);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(238, 90, 90, 0.4);
}

.donate-btn i {
    font-size: 1rem;
}

/* 후원 모달 */
.donate-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.donate-modal-overlay.active {
    display: flex;
}

.donate-modal-content {
    background: #2a2a2a;
    border-radius: 1rem;
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    text-align: center;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.donate-modal-content h3 {
    color: #fff;
    margin: 0 0 0.5rem 0;
    font-size: 1.5rem;
}

.donate-modal-content > p {
    color: #aaa;
    margin: 0 0 1.5rem 0;
    font-size: 0.9rem;
}

.donate-modal-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: none;
    border: none;
    color: #888;
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    padding: 0.25rem;
}

.donate-modal-close:hover {
    color: #fff;
}

.donate-options {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.donate-option.coffee-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background: linear-gradient(135deg, #ffdd00, #ffc800);
    color: #333;
    padding: 1rem 1.5rem;
    border-radius: 0.75rem;
    font-size: 1.1rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.donate-option.coffee-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 200, 0, 0.4);
}

.donate-option.coffee-btn i {
    font-size: 1.3rem;
}

.donate-option.qr-option {
    background: #333;
    border-radius: 0.75rem;
    padding: 1rem;
}

.donate-option.qr-option p {
    color: #aaa;
    margin: 0 0 0.75rem 0;
    font-size: 0.9rem;
}

.donate-qr {
    width: 180px;
    height: 180px;
    border-radius: 0.5rem;
    background: white;
    padding: 0.5rem;
}
