/* Small additions on top of Tailwind. */

/* Smooth theme transitions (avoid jarring flash on toggle). */
html, body {
  transition: background-color 150ms ease, color 150ms ease;
}

/* Focus ring visible in both themes. */
:focus-visible {
  outline: 2px solid #E4397C;
  outline-offset: 2px;
  border-radius: 4px;
}

::selection {
  background: #E4397C;
  color: #fff;
}

/* ── Nickname sparkle (포인트샵 '반짝임' 아이템) ─────────── */
.nickname-sparkle {
  position: relative;
  display: inline-block;
  padding: 0 0.9em;   /* 좌우 여유 — 반짝이가 텍스트 바깥에서 빛남 */
}
.nickname-sparkle::before,
.nickname-sparkle::after {
  content: '✦';
  position: absolute;
  font-size: 0.85em;
  color: #FBBF24;
  opacity: 0.55;       /* 항상 은은하게 보이도록 최소 밝기 */
  animation: nickname-sparkle-twinkle 1.8s ease-in-out infinite;
  text-shadow: 0 0 6px rgba(251, 191, 36, 0.8);
  pointer-events: none;
  line-height: 1;
  /* 운영 OS 에 BMP 심볼 글리프가 없으면 .notdef 박스/물음표로 깨짐 — 다중 emoji/symbol 폰트로 fallback */
  font-family: "Apple Color Emoji", "Segoe UI Symbol", "Segoe UI Emoji",
               "Noto Color Emoji", "Noto Sans Symbols 2", "Noto Sans Symbols",
               "Symbola", sans-serif;
}
.nickname-sparkle::before {
  top: -0.35em;
  left: -0.05em;
  animation-delay: 0s;
}
.nickname-sparkle::after {
  bottom: -0.35em;
  right: -0.05em;
  animation-delay: 0.9s;
}
/* 하트 변형 — 분홍 ❤ */
.nickname-sparkle-heart::before,
.nickname-sparkle-heart::after {
  content: '❤';
  color: #F472B6;
  text-shadow: 0 0 6px rgba(244, 114, 182, 0.8);
}
/* 별 변형 — 청록 ★ */
.nickname-sparkle-star::before,
.nickname-sparkle-star::after {
  content: '★';
  color: #38BDF8;
  text-shadow: 0 0 6px rgba(56, 189, 248, 0.8);
}
/* 다이아 — 화이트 ◆ */
.nickname-sparkle-diamond::before,
.nickname-sparkle-diamond::after {
  content: '◆';
  color: #F8FAFC;
  text-shadow: 0 0 6px rgba(248, 250, 252, 0.95);
}
/* 꽃잎 — 코랄 ❀ */
.nickname-sparkle-flower::before,
.nickname-sparkle-flower::after {
  content: '❀';
  color: #FB7185;
  text-shadow: 0 0 6px rgba(251, 113, 133, 0.85);
}
/* 번개 — 옐로 ⚡ */
.nickname-sparkle-lightning::before,
.nickname-sparkle-lightning::after {
  content: '⚡';
  color: #FACC15;
  text-shadow: 0 0 6px rgba(250, 204, 21, 0.95);
}
/* 왕관 — 골드 ♛ */
.nickname-sparkle-crown::before,
.nickname-sparkle-crown::after {
  content: '♛';
  color: #EAB308;
  text-shadow: 0 0 6px rgba(234, 179, 8, 0.9);
}
/* 나비 — 라일락 ✿ */
.nickname-sparkle-butterfly::before,
.nickname-sparkle-butterfly::after {
  content: '✿';
  color: #C084FC;
  text-shadow: 0 0 6px rgba(192, 132, 252, 0.85);
}
/* 음표 — 민트 ♪ */
.nickname-sparkle-music::before,
.nickname-sparkle-music::after {
  content: '♪';
  color: #2DD4BF;
  text-shadow: 0 0 6px rgba(45, 212, 191, 0.9);
}
@keyframes nickname-sparkle-twinkle {
  0%, 100% { opacity: 0.5; transform: scale(0.9) rotate(0deg); }
  50%      { opacity: 1;   transform: scale(1.3) rotate(25deg); }
}

/* Tailwind 정적 컴파일 산물(tailwind.css) 이 `max-md:pointer-events-none` 클래스를
 * 포함하고 있지 않을 때(템플릿이 새로 추가된 직후) 즉시 동작하도록 동등 rule
 * 을 수동 정의. Tailwind 재컴파일 시에도 같은 selector 가 생성되어 중복 무해.
 * 모바일(<md=768px) 에서 글 목록 행의 닉네임 .nick-trigger popover 차단용. */
@media (max-width: 767.98px) {
  .max-md\:pointer-events-none {
    pointer-events: none;
  }
}

/* ── 닉네임 셀 — sparkle 안 잘림 truncate ─────────────────
 * .nickname-sparkle 의 ::before/::after 는 박스 위/아래로 0.35em + text-shadow
 * 까지 그림자 렌더되는데, 부모가 일반 `truncate`(overflow:hidden) 면 잘림.
 * overflow:clip + overflow-clip-margin 으로 박스 바깥 0.6em 까지 렌더 허용.
 * text-overflow:ellipsis 는 spec 상 clip 에서도 동작.
 * 브라우저: Chrome 90+, Firefox 102+, Safari 15.4+. */
.nick-cell {
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: clip;
  overflow-clip-margin: 0.6em;
}

/* ── 닉네임 묶음 래퍼 ─────────────────────────────────
 * role-badge + lvl-box + nickname 을 단일 inline-flex 덩어리로 묶어
 * 부모 flex 행에서 한 요소처럼 동작하게 한다. */
.styled-nick {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  vertical-align: middle;
}
/* button.styled-nick (클릭 가능한 트리거) — 기본 버튼 스타일 제거 */
button.styled-nick {
  background: transparent;
  border: 0;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-align: inherit;
}
button.styled-nick:hover .nickname { text-decoration: underline; }

/* 닉네임 팝오버 — 컴팩트, viewport 기준 fixed (클릭 좌표 직접 적용) */
.nick-popover {
  position: fixed;
  z-index: 9999;
  min-width: 140px;
  border-radius: 0.375rem;
  background: #fff;
  border: 1px solid #E5E7EB;
  box-shadow: 0 6px 16px rgba(0,0,0,0.12);
  overflow: hidden;
  font-size: 0.75rem;
}
.dark .nick-popover {
  background: #1E1E1E;
  border-color: #333333;
  box-shadow: 0 6px 16px rgba(0,0,0,0.5);
}
.user-menu__head {
  padding: 0.4rem 0.625rem;
  background: rgba(252, 228, 236, 0.4);
  border-bottom: 1px solid #F8BBD0;
  font-weight: 600;
  font-size: 0.75rem;
}
.dark .user-menu__head {
  background: #2A1F25;
  border-bottom-color: #3A2230;
}
.user-menu__list { list-style: none; margin: 0; padding: 0.125rem 0; }
.user-menu__list li > a,
.user-menu__list li > form > button {
  display: block;
  width: 100%;
  padding: 0.3rem 0.625rem;
  text-align: left;
  background: transparent;
  border: 0;
  color: inherit;
  cursor: pointer;
  font-size: 0.75rem;
  line-height: 1.3;
  text-decoration: none;
  white-space: nowrap;
}
.user-menu__list li > a:hover,
.user-menu__list li > form > button:hover {
  background: rgba(252, 228, 236, 0.4);
  color: #E4397C;
}
.dark .user-menu__list li > a:hover,
.dark .user-menu__list li > form > button:hover {
  background: #2A1F25;
}
.user-menu__sep {
  height: 1px;
  background: #E5E7EB;
  margin: 0.125rem 0;
}
.dark .user-menu__sep { background: #333333; }
.user-menu__danger { color: #DC2626 !important; }
.user-menu__danger:hover { background: #FEE2E2 !important; color: #B91C1C !important; }
.dark .user-menu__danger:hover { background: #2A1515 !important; }

/* ── 레벨 박스 (기본 10단위 색상) ─────────────────────── */
.lvl-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.8em;
  height: 1.4em;
  padding: 0 0.35em;
  margin-right: 0.3em;
  font-size: 0.75em;
  font-weight: 700;
  line-height: 1;
  border-radius: 3px;
  color: #fff;
  background: #6B7280;      /* fallback */
  letter-spacing: -0.02em;
  vertical-align: 1px;
}
/* 기본: level_num 10단위 버킷(0..9) */
.lvl-b0 { background: #6B7280; }
.lvl-b1 { background: #22C55E; }
.lvl-b2 { background: #0EA5E9; }
.lvl-b3 { background: #6366F1; }
.lvl-b4 { background: #A855F7; }
.lvl-b5 { background: #E4397C; }
.lvl-b6 { background: #EF4444; }
.lvl-b7 { background: #F97316; }
.lvl-b8 { background: #D4AF37; }
.lvl-b9 { background: #111827; border: 1px solid #FDE68A; }

/* ── 포인트샵 구매형 레벨 스타일 20종 ─────────────────── */
/* 솔리드 계열 */
.lvl-crimson    { background: #B91C1C; }
.lvl-gold       { background: linear-gradient(135deg,#F59E0B,#D97706); color:#1a1a1a; text-shadow: 0 1px 0 rgba(255,255,255,0.4); }
.lvl-silver     { background: linear-gradient(135deg,#D1D5DB,#9CA3AF); color:#1a1a1a; }
.lvl-bronze     { background: linear-gradient(135deg,#B45309,#7C2D12); }
.lvl-ivory      { background: #F5F1E8; color: #3F2A1D; border: 1px solid #E2D7B4; }
.lvl-carbon     { background: #0F172A; border: 1px solid #334155; color: #E2E8F0; }
.lvl-sakura     { background: #FFD6E7; color: #9D174D; }
.lvl-emerald    { background: linear-gradient(135deg,#10B981,#047857); }
.lvl-royal      { background: linear-gradient(135deg,#2563EB,#1E3A8A); }
/* 네온 계열 — 글로우 */
.lvl-neon-pink  { background: #020617; color: #F472B6; box-shadow: 0 0 6px rgba(244,114,182,0.9), inset 0 0 3px rgba(244,114,182,0.6); }
.lvl-neon-cyan  { background: #020617; color: #22D3EE; box-shadow: 0 0 6px rgba(34,211,238,0.9), inset 0 0 3px rgba(34,211,238,0.6); }
.lvl-neon-green { background: #020617; color: #4ADE80; box-shadow: 0 0 6px rgba(74,222,128,0.9), inset 0 0 3px rgba(74,222,128,0.6); }
/* 그라데이션 */
.lvl-galaxy     { background: linear-gradient(135deg,#1E40AF,#7C3AED,#EC4899); }
.lvl-sunset     { background: linear-gradient(135deg,#F59E0B,#EC4899); }
.lvl-ocean      { background: linear-gradient(135deg,#0EA5E9,#1E3A8A); }
.lvl-fire       { background: linear-gradient(135deg,#FCD34D,#DC2626); color: #1a1a1a; }
.lvl-aurora     { background: linear-gradient(135deg,#10B981,#7C3AED); }
.lvl-rainbow    { background: linear-gradient(90deg,#EF4444,#F97316,#F59E0B,#22C55E,#0EA5E9,#7C3AED,#EC4899); color: #fff; text-shadow: 0 0 3px rgba(0,0,0,0.8); }
/* 효과 */
.lvl-sparkle-gold { background: linear-gradient(135deg,#F59E0B,#D97706); color:#1a1a1a; position: relative; animation: lvl-pulse 2s infinite; }
.lvl-pulse-red    { background: #DC2626; animation: lvl-pulse 1.4s ease-in-out infinite; }
@keyframes lvl-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.55); }
  50%      { box-shadow: 0 0 0 4px rgba(220, 38, 38, 0); }
}

/* 역할 뱃지 */
.role-badge {
  display: inline-flex;
  align-items: center;
  padding: 0 0.4em;
  height: 1.4em;
  margin-right: 0.3em;
  font-size: 0.7em;
  font-weight: 700;
  line-height: 1;
  border-radius: 3px;
  background: #111827;
  color: #FDE68A;
  border: 1px solid #FDE68A;
  letter-spacing: -0.02em;
  vertical-align: 1px;
}
.role-badge.role-superuser    { background: #7C2D12; color: #FED7AA; border-color: #F97316; }
.role-badge.role-admin        { background: #7C3AED; color: #DDD6FE; border-color: #A78BFA; }
.role-badge.role-board-manager{ background: #0F766E; color: #CCFBF1; border-color: #2DD4BF; }

/* ── 인증 폼 입력 공통 스타일 (로그인/회원가입) ─────────────
 * Tailwind CDN 은 <style> 내 @apply 미지원이라 순수 CSS 로 작성.
 */
.auth-form input[type=text],
.auth-form input[type=password],
.auth-form input[type=email],
.auth-form input[type=number],
.auth-form input[type=tel],
.auth-form input[type=url],
.auth-form select,
.auth-form textarea {
  display: block;
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  line-height: 1.4;
  border-radius: 0.375rem;
  border: 1px solid #EEEEEE;
  background: #FFFFFF;
  color: #2D2D2D;
  box-sizing: border-box;
  transition: border-color 120ms, box-shadow 120ms;
}
.auth-form input:focus,
.auth-form select:focus,
.auth-form textarea:focus {
  outline: none;
  border-color: #E4397C;
  box-shadow: 0 0 0 1px #E4397C;
}
.dark .auth-form input[type=text],
.dark .auth-form input[type=password],
.dark .auth-form input[type=email],
.dark .auth-form input[type=number],
.dark .auth-form input[type=tel],
.dark .auth-form input[type=url],
.dark .auth-form select,
.dark .auth-form textarea {
  border-color: #333333;
  background: #2A2A2A;
  color: #E8E8E8;
}
.auth-form ::placeholder { color: #AAAAAA; }
.dark .auth-form ::placeholder { color: #6B6B6B; }
