/* ============================================================
   iPlan — RPG 게이미피케이션 UI
   레벨, XP, 진행도, 보물상자, 보스전, 스킬트리 스타일
   ============================================================ */

/* ── RPG 전용 토큰 ── */
:root {
  --ip-xp-bar-h: 6px;
  --ip-xp-color: var(--accent);
  --ip-xp-bg: var(--surface-w2);
  --ip-gold-color: #f59e0b;
  --ip-gem-color: #8b5cf6;
  --ip-hp-color: #ef4444;
  --ip-mp-color: #3b82f6;
  --ip-level-glow: 0 0 12px rgba(45, 212, 191, 0.3);
}

/* ── 레벨 배지 (사이드바/프로필) ── */
.ip-level-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  padding: var(--s-0) var(--s-2);
  background: var(--accent-dim);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  color: var(--accent);
}

.ip-level-badge-icon {
  width: 14px;
  height: 14px;
}

/* ── XP 진행 바 ── */
.ip-xp-bar {
  position: relative;
  width: 100%;
  height: var(--ip-xp-bar-h);
  background: var(--ip-xp-bg);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.ip-xp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--ip-xp-color), var(--accent-hover));
  border-radius: var(--radius-full);
  transition: width 0.6s var(--ease-default);
  position: relative;
}

.ip-xp-bar-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.15) 50%,
    transparent 100%
  );
  animation: xpShimmer 2s ease-in-out infinite;
}

@keyframes xpShimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(200%); }
}

.ip-xp-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--s-1);
  font-size: var(--text-xs);
  color: var(--text-faint);
}

.ip-xp-label {
  font-weight: var(--weight-medium);
  color: var(--accent-text);
}

/* ── XP 획득 팝업 ── */
.ip-xp-popup {
  position: fixed;
  pointer-events: none;
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  color: var(--ip-xp-color);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
  animation: xpFloat 1.2s var(--ease-default) forwards;
  z-index: var(--z-tooltip);
}

@keyframes xpFloat {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  60% {
    opacity: 1;
    transform: translateY(-30px) scale(1.1);
  }
  100% {
    opacity: 0;
    transform: translateY(-50px) scale(0.9);
  }
}

/* ── 레벨업 오버레이 ── */
.ip-levelup-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  z-index: var(--z-modal);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-slow) var(--ease-default);
}

.ip-levelup-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.ip-levelup-card {
  background: var(--bg-raised);
  border: 1px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: var(--s-8);
  text-align: center;
  max-width: 320px;
  width: 90%;
  box-shadow: var(--ip-level-glow), var(--shadow-lg);
  animation: levelUpBounce 0.6s var(--ease-default);
}

@keyframes levelUpBounce {
  0% { transform: scale(0.5); opacity: 0; }
  60% { transform: scale(1.05); }
  100% { transform: scale(1); opacity: 1; }
}

.ip-levelup-icon {
  font-size: 48px;
  margin-bottom: var(--s-4);
}

.ip-levelup-title {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--accent);
  margin-bottom: var(--s-2);
}

.ip-levelup-desc {
  font-size: var(--text-sm);
  color: var(--text-sub);
  margin-bottom: var(--s-6);
}

/* ── 화폐 표시 ── */
.ip-currency {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
}

.ip-currency--gold {
  color: var(--ip-gold-color);
}

.ip-currency--gem {
  color: var(--ip-gem-color);
}

.ip-currency-icon {
  width: 14px;
  height: 14px;
}

/* ── 보물상자 ── */
.ip-chest {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: var(--radius-card);
  background: var(--surface-w2);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-default);
  position: relative;
}

.ip-chest:hover {
  border-color: var(--ip-gold-color);
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.2);
  transform: translateY(-2px);
}

.ip-chest-icon {
  font-size: 32px;
}

.ip-chest.opening {
  animation: chestOpen 0.8s var(--ease-default);
}

@keyframes chestOpen {
  0% { transform: scale(1); }
  20% { transform: scale(1.1) rotate(-3deg); }
  40% { transform: scale(1.1) rotate(3deg); }
  60% { transform: scale(1.15) rotate(-2deg); }
  80% { transform: scale(1.05) rotate(0); }
  100% { transform: scale(1); }
}

/* ── 스탯 카드 (프로필 패널) ── */
.ip-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--s-3);
}

.ip-stat-card {
  background: var(--surface-w1);
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius-md);
  padding: var(--s-4);
  text-align: center;
}

.ip-stat-value {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--text-main);
  margin-bottom: var(--s-1);
}

.ip-stat-label {
  font-size: var(--text-xs);
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── 스트릭 (연속 달성) ── */
.ip-streak {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-4);
  background: var(--warning-dim);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--warning);
}

.ip-streak-icon {
  font-size: var(--text-lg);
}

.ip-streak-count {
  font-weight: var(--weight-bold);
}

/* ── 서브태스크 진행 바 (태스크 카드 내) ── */
.ip-subtask-progress {
  width: 100%;
  height: 2px;
  background: var(--surface-w2);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: var(--s-1);
}

.ip-subtask-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: var(--radius-full);
  transition: width 0.4s var(--ease-default);
}

/* ── 일일 퀘스트 카드 ── */
.ip-quest-card {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  background: var(--surface-w1);
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius-md);
  transition: background var(--duration-fast) var(--ease-default);
}

.ip-quest-card:hover {
  background: var(--surface-hover);
}

.ip-quest-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--accent-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-md);
  flex-shrink: 0;
}

.ip-quest-info {
  flex: 1;
  min-width: 0;
}

.ip-quest-title {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-main);
}

.ip-quest-desc {
  font-size: var(--text-xs);
  color: var(--text-faint);
}

.ip-quest-reward {
  display: flex;
  align-items: center;
  gap: var(--s-1);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--ip-gold-color);
  flex-shrink: 0;
}

.ip-quest-card.completed {
  opacity: 0.5;
  text-decoration: line-through;
}

/* ── 보스전 배너 ── */
.ip-boss-banner {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-5);
  background: linear-gradient(135deg, var(--danger-dim), var(--surface-w1));
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-card);
  margin-bottom: var(--s-4);
}

.ip-boss-icon {
  width: 48px;
  height: 48px;
  font-size: 36px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ip-boss-info {
  flex: 1;
}

.ip-boss-name {
  font-size: var(--text-md);
  font-weight: var(--weight-bold);
  color: var(--danger);
  margin-bottom: var(--s-1);
}

.ip-boss-hp-bar {
  width: 100%;
  height: 8px;
  background: var(--surface-w3);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.ip-boss-hp-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--ip-hp-color), #dc2626);
  border-radius: var(--radius-full);
  transition: width 0.6s var(--ease-default);
}

.ip-boss-hp-text {
  font-size: var(--text-xs);
  color: var(--text-faint);
  margin-top: var(--s-1);
}

/* ── 스킬트리 (Phase 2+ 기본 구조) ── */
.ip-skill-node {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  background: var(--surface-w2);
  border: 2px solid var(--line);
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-default);
  position: relative;
}

.ip-skill-node:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.ip-skill-node.unlocked {
  border-color: var(--accent);
  background: var(--accent-dim);
  box-shadow: var(--ip-level-glow);
}

.ip-skill-node.locked {
  opacity: 0.4;
  cursor: not-allowed;
}

.ip-skill-node-icon {
  width: 24px;
  height: 24px;
}

/* ── 장비 슬롯 ── */
.ip-equipment-slot {
  width: 56px;
  height: 56px;
  border: 2px dashed var(--line);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-default);
}

.ip-equipment-slot:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.ip-equipment-slot.equipped {
  border-style: solid;
  border-color: var(--accent);
  background: var(--accent-dim);
}

.ip-equipment-slot-icon {
  font-size: var(--text-xl);
}

/* ── 전직 시스템 배지 ── */
.ip-class-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  padding: var(--s-0) var(--s-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  border: 1px solid;
}

.ip-class-badge--novice {
  color: var(--text-sub);
  border-color: var(--line);
  background: var(--surface-w2);
}

.ip-class-badge--warrior {
  color: var(--danger);
  border-color: var(--danger);
  background: var(--danger-dim);
}

.ip-class-badge--mage {
  color: var(--info);
  border-color: var(--info);
  background: var(--info-dim);
}

.ip-class-badge--sage {
  color: var(--ip-gem-color);
  border-color: var(--ip-gem-color);
  background: var(--ip-gem-dim);
}

.ip-class-badge--master {
  color: var(--ip-gold-color);
  border-color: var(--ip-gold-color);
  background: var(--warning-dim);
}
