/* ============================================
   프린세스 커넥트! Re:Dive - 스타일시트
   애니메 RPG 가챠 게임 UI
   ============================================ */

/* ===== CSS 변수 ===== */
:root {
  --primary: #4a90d9;
  --primary-dark: #3570b0;
  --primary-light: #6aabef;
  --secondary: #f5a623;
  --secondary-dark: #d48c10;
  --accent: #e74c6f;
  --accent-light: #f06990;
  --dark-bg: #1a1a2e;
  --dark-bg-2: #16213e;
  --card-bg: #0f3460;
  --card-bg-light: #1a4a7a;
  --text-primary: #ffffff;
  --text-secondary: #b8c5d6;
  --text-muted: #7889a0;
  --success: #4caf50;
  --danger: #e74c3c;
  --warning: #f5a623;
  --star-gold: #ffd700;
  --star-purple: #b366ff;
  --star-blue: #4a90d9;
  --rarity-3: #ffd700;
  --rarity-2: #b366ff;
  --rarity-1: #4a90d9;
  --top-bar-height: 56px;
  --bottom-nav-height: 60px;
  --game-max-width: 480px;
  --transition-speed: 0.3s;
}

/* ===== 글로벌 리셋 & 기본 ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: 'Segoe UI', 'Malgun Gothic', '맑은 고딕', sans-serif;
  background-color: #0d0d1a;
  color: var(--text-primary);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

/* 커스텀 스크롤바 */
::-webkit-scrollbar {
  width: 4px;
}
::-webkit-scrollbar-track {
  background: var(--dark-bg);
}
::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--primary-light);
}

/* ===== 게임 컨테이너 ===== */
#game-container {
  max-width: var(--game-max-width);
  margin: 0 auto;
  height: 100vh;
  position: relative;
  background: var(--dark-bg);
  overflow: hidden;
  box-shadow: 0 0 40px rgba(74, 144, 217, 0.15);
}

/* ===== 상단 바 ===== */
#top-bar {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--game-max-width);
  height: var(--top-bar-height);
  background: linear-gradient(180deg, rgba(15, 52, 96, 0.95) 0%, rgba(22, 33, 62, 0.9) 100%);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 100;
  border-bottom: 1px solid rgba(74, 144, 217, 0.3);
}

.top-bar-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px 4px;
  height: calc(var(--top-bar-height) - 6px);
}

.player-info-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.player-level {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  border: 1px solid var(--primary-light);
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.player-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.player-info-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.resource-item {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(0, 0, 0, 0.3);
  padding: 3px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.resource-icon {
  font-size: 14px;
}

.resource-value {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

.exp-bar-container {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: rgba(0, 0, 0, 0.4);
}

.exp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--secondary), var(--secondary-dark));
  transition: width 0.5s ease;
  border-radius: 0 2px 2px 0;
  box-shadow: 0 0 6px rgba(245, 166, 35, 0.5);
}

/* ===== 하단 내비게이션 ===== */
#bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--game-max-width);
  height: var(--bottom-nav-height);
  background: linear-gradient(0deg, rgba(15, 52, 96, 0.98) 0%, rgba(22, 33, 62, 0.95) 100%);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 100;
  border-top: 1px solid rgba(74, 144, 217, 0.3);
}

.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 8px;
  transition: all var(--transition-speed) ease;
  position: relative;
}

.nav-btn .nav-icon {
  font-size: 20px;
  transition: transform 0.2s ease;
}

.nav-btn .nav-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.nav-btn.active {
  color: var(--primary-light);
}

.nav-btn.active::after {
  content: '';
  position: absolute;
  top: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 30px;
  height: 3px;
  background: var(--primary);
  border-radius: 0 0 3px 3px;
  box-shadow: 0 0 8px var(--primary);
}

.nav-btn.active .nav-icon {
  transform: scale(1.15);
  filter: drop-shadow(0 0 4px var(--primary));
}

.nav-btn:active {
  transform: scale(0.92);
}

/* ===== 메인 콘텐츠 ===== */
#main-content {
  position: relative;
  height: 100vh;
  padding-top: var(--top-bar-height);
  padding-bottom: var(--bottom-nav-height);
  overflow: hidden;
}

.screen {
  position: absolute;
  top: var(--top-bar-height);
  left: 0;
  width: 100%;
  height: calc(100vh - var(--top-bar-height) - var(--bottom-nav-height));
  overflow-y: auto;
  overflow-x: hidden;
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.screen.active {
  display: block;
  opacity: 1;
}

.screen.screen-entering {
  display: block;
  animation: fadeIn 0.3s ease forwards;
}

.screen.screen-leaving {
  display: block;
  animation: fadeOut 0.2s ease forwards;
}

/* ===== 로딩 화면 ===== */
#screen-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--dark-bg) 0%, var(--dark-bg-2) 50%, #0a1628 100%);
}

#screen-loading.active {
  display: flex;
}

.loading-container {
  text-align: center;
  padding: 20px;
  width: 100%;
}

.loading-logo h1 {
  font-size: 28px;
  background: linear-gradient(135deg, var(--secondary), #ffe066, var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
  filter: drop-shadow(0 2px 4px rgba(245, 166, 35, 0.3));
  margin-bottom: 4px;
}

.loading-logo h2 {
  font-size: 16px;
  color: var(--primary-light);
  letter-spacing: 4px;
  font-weight: 400;
}

.loading-bar-container {
  width: 80%;
  max-width: 300px;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  margin: 40px auto 16px;
  overflow: hidden;
}

.loading-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  border-radius: 3px;
  transition: width 0.3s ease;
  box-shadow: 0 0 10px var(--primary);
}

.loading-text {
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 30px;
}

.loading-tips {
  color: var(--text-muted);
  font-size: 12px;
  padding: 0 20px;
}

/* ===== 로그인 화면 ===== */
#screen-login {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--dark-bg) 0%, var(--dark-bg-2) 100%);
}

#screen-login.active {
  display: flex;
}

.login-container {
  width: 100%;
  padding: 30px 24px;
  text-align: center;
}

.login-logo {
  margin-bottom: 40px;
}

.login-logo h1 {
  font-size: 26px;
  background: linear-gradient(135deg, var(--secondary), #ffe066);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-logo h2 {
  font-size: 14px;
  color: var(--primary-light);
  letter-spacing: 3px;
  font-weight: 400;
}

.login-form {
  margin-bottom: 20px;
}

.form-group {
  margin-bottom: 16px;
  text-align: left;
}

.form-group label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  padding-left: 4px;
}

.form-group input {
  width: 100%;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(74, 144, 217, 0.3);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.form-group input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.15);
}

.form-group input::placeholder {
  color: var(--text-muted);
}

.login-divider {
  position: relative;
  margin: 24px 0;
  text-align: center;
}

.login-divider::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 100%;
  height: 1px;
  background: rgba(255, 255, 255, 0.15);
}

.login-divider span {
  position: relative;
  background: var(--dark-bg);
  padding: 0 16px;
  color: var(--text-muted);
  font-size: 13px;
}

.login-notice {
  margin-top: 16px;
  font-size: 11px;
  color: var(--text-muted);
}

/* ===== 버튼 ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 24px;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  letter-spacing: 0.5px;
}

.btn::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 50%;
  background: linear-gradient(180deg, rgba(255,255,255,0.1), transparent);
  pointer-events: none;
}

.btn:active {
  transform: scale(0.95);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: 0 4px 15px rgba(74, 144, 217, 0.4);
  border: 1px solid var(--primary-light);
}

.btn-primary:hover {
  box-shadow: 0 4px 20px rgba(74, 144, 217, 0.6);
}

.btn-secondary {
  background: linear-gradient(135deg, var(--card-bg-light), var(--card-bg));
  color: var(--text-primary);
  border: 1px solid rgba(74, 144, 217, 0.3);
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger), #c0392b);
  color: white;
  border: 1px solid #e74c3c;
}

.btn-large {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  border-radius: 12px;
}

.btn-small {
  padding: 6px 14px;
  font-size: 12px;
  border-radius: 8px;
}

.btn-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}

.btn-back {
  background: none;
  border: none;
  color: var(--primary-light);
  font-size: 14px;
  cursor: pointer;
  padding: 8px 0;
  margin-bottom: 12px;
}

/* ===== 홈 화면 ===== */
.home-container {
  padding: 16px;
}

.welcome-banner {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 16px;
  height: 140px;
}

.welcome-banner-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #1a3a5c 0%, #0f3460 30%, #2a1a5e 70%, #4a1942 100%);
  animation: bannerShimmer 8s ease-in-out infinite alternate;
}

@keyframes bannerShimmer {
  0% { filter: brightness(1); }
  50% { filter: brightness(1.15); }
  100% { filter: brightness(1); }
}

.welcome-banner-content {
  position: relative;
  z-index: 1;
  padding: 30px 20px;
  text-align: center;
}

.welcome-banner-content h2 {
  font-size: 22px;
  margin-bottom: 8px;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.welcome-banner-content p {
  font-size: 13px;
  color: var(--text-secondary);
}

/* 출석 보상 팝업 */
.daily-login-popup {
  display: none;
  background: linear-gradient(135deg, var(--card-bg), var(--dark-bg-2));
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 16px;
  border: 1px solid rgba(245, 166, 35, 0.4);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.daily-login-popup.show {
  display: block;
  animation: slideUp 0.4s ease;
}

.daily-login-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.daily-login-header h3 {
  font-size: 16px;
  color: var(--secondary);
}

.daily-login-content {
  margin-bottom: 12px;
}

.daily-reward-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.daily-reward-item {
  aspect-ratio: 1;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
}

.daily-reward-item.claimed {
  opacity: 0.4;
}

.daily-reward-item.claimed::after {
  content: '✓';
  position: absolute;
  font-size: 18px;
  color: var(--success);
}

.daily-reward-item.today {
  border-color: var(--secondary);
  box-shadow: 0 0 8px rgba(245, 166, 35, 0.4);
}

.daily-reward-icon {
  font-size: 18px;
  margin-bottom: 2px;
}

.daily-reward-amount {
  font-size: 9px;
  color: var(--text-secondary);
}

/* 홈 메뉴 그리드 */
.home-menu-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.home-menu-item {
  background: linear-gradient(135deg, var(--card-bg), var(--card-bg-light));
  border: 1px solid rgba(74, 144, 217, 0.2);
  border-radius: 14px;
  padding: 16px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.home-menu-item:active {
  transform: scale(0.95);
  box-shadow: 0 0 12px rgba(74, 144, 217, 0.3);
}

.menu-icon {
  font-size: 28px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.home-menu-item span {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

/* 공지사항 */
.home-announcements {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 12px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.home-announcements h3 {
  font-size: 14px;
  margin-bottom: 10px;
  color: var(--text-secondary);
}

.announcement-list {
  list-style: none;
}

.announcement-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 13px;
  color: var(--text-secondary);
}

.announcement-item:last-child {
  border-bottom: none;
}

.announcement-tag {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 700;
  white-space: nowrap;
}

.tag-event {
  background: rgba(231, 76, 111, 0.2);
  color: var(--accent);
  border: 1px solid rgba(231, 76, 111, 0.3);
}

.tag-update {
  background: rgba(74, 144, 217, 0.2);
  color: var(--primary-light);
  border: 1px solid rgba(74, 144, 217, 0.3);
}

.tag-notice {
  background: rgba(245, 166, 35, 0.2);
  color: var(--secondary);
  border: 1px solid rgba(245, 166, 35, 0.3);
}

/* ===== 가챠 화면 ===== */
.gacha-container {
  padding: 16px;
  position: relative;
}

.gacha-banner {
  margin-bottom: 16px;
}

.gacha-banner-image {
  position: relative;
  height: 180px;
  border-radius: 16px;
  overflow: hidden;
}

.gacha-banner-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    #1a237e 0%,
    #4a148c 25%,
    #880e4f 50%,
    #e65100 75%,
    #f9a825 100%
  );
  background-size: 200% 200%;
  animation: gachaBannerFlow 6s ease-in-out infinite;
}

@keyframes gachaBannerFlow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.gacha-banner-text {
  position: relative;
  z-index: 1;
  text-align: center;
  padding-top: 40px;
}

.gacha-banner-text h2 {
  font-size: 24px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.7);
  margin-bottom: 8px;
}

.gacha-banner-text p {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

.gacha-period {
  font-size: 12px !important;
  color: rgba(255, 255, 255, 0.6) !important;
  margin-top: 8px;
}

.gacha-info {
  margin-bottom: 20px;
}

.gacha-rates {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 10px;
  padding: 12px 16px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.gacha-rates h4 {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.rate-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 13px;
}

.star-3 { color: var(--rarity-3); }
.star-2 { color: var(--rarity-2); }
.star-1 { color: var(--rarity-1); }

.gacha-buttons {
  display: flex;
  gap: 12px;
}

.btn-gacha {
  flex: 1;
  padding: 16px 12px;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  font-weight: 700;
}

.btn-gacha-single {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border: 2px solid var(--primary-light);
  color: white;
  box-shadow: 0 4px 15px rgba(74, 144, 217, 0.4);
}

.btn-gacha-ten {
  background: linear-gradient(135deg, var(--secondary), var(--secondary-dark));
  border: 2px solid #ffe066;
  color: #1a1a2e;
  box-shadow: 0 4px 15px rgba(245, 166, 35, 0.4);
  animation: pulse 2s ease-in-out infinite;
}

.gacha-btn-label {
  font-size: 16px;
}

.gacha-btn-cost {
  font-size: 13px;
  opacity: 0.85;
}

/* 가챠 결과 오버레이 */
.gacha-result-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--game-max-width);
  height: 100vh;
  background: rgba(0, 0, 0, 0.92);
  z-index: 200;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.gacha-result-overlay.show {
  display: flex;
  animation: fadeIn 0.3s ease;
}

.gacha-result-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-bottom: 30px;
  max-width: 400px;
}

.gacha-card {
  width: 80px;
  height: 100px;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  opacity: 0;
  transform: rotateY(90deg) scale(0.5);
  animation: cardReveal 0.6s ease forwards;
  overflow: hidden;
}

.gacha-card.rarity-3 {
  background: linear-gradient(135deg, #2a1f00, #4a3500);
  border: 2px solid var(--rarity-3);
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.5), inset 0 0 20px rgba(255, 215, 0, 0.1);
}

.gacha-card.rarity-2 {
  background: linear-gradient(135deg, #1f0a3a, #350f5a);
  border: 2px solid var(--rarity-2);
  box-shadow: 0 0 15px rgba(179, 102, 255, 0.4), inset 0 0 15px rgba(179, 102, 255, 0.1);
}

.gacha-card.rarity-1 {
  background: linear-gradient(135deg, #0a1f3a, #0f2f5a);
  border: 2px solid var(--rarity-1);
  box-shadow: 0 0 10px rgba(74, 144, 217, 0.3);
}

.gacha-card-name {
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 4px;
  padding: 0 4px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

.gacha-card-stars {
  font-size: 10px;
  letter-spacing: 1px;
}

.gacha-card.rarity-3 .gacha-card-stars { color: var(--rarity-3); }
.gacha-card.rarity-2 .gacha-card-stars { color: var(--rarity-2); }
.gacha-card.rarity-1 .gacha-card-stars { color: var(--rarity-1); }

.gacha-card-sprite {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 16px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.gacha-card .sparkle {
  position: absolute;
  width: 6px;
  height: 6px;
  background: white;
  border-radius: 50%;
  animation: sparkle 1.5s ease-in-out infinite;
}

.gacha-card .sparkle:nth-child(1) { top: 10%; left: 15%; animation-delay: 0s; }
.gacha-card .sparkle:nth-child(2) { top: 20%; right: 10%; animation-delay: 0.3s; }
.gacha-card .sparkle:nth-child(3) { bottom: 15%; left: 20%; animation-delay: 0.6s; }
.gacha-card .sparkle:nth-child(4) { bottom: 25%; right: 15%; animation-delay: 0.9s; }

.gacha-card-new {
  position: absolute;
  top: 4px;
  right: 4px;
  background: var(--accent);
  color: white;
  font-size: 8px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
}

#btn-gacha-result-close {
  min-width: 200px;
}

/* ===== 배틀 선택 화면 ===== */
.battle-select-container {
  padding: 16px;
}

.battle-select-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.battle-select-header h2 {
  font-size: 20px;
}

.area-selector {
  display: flex;
  gap: 6px;
}

.area-tab {
  transition: all 0.2s ease;
}

.area-tab.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark)) !important;
  border-color: var(--primary-light) !important;
}

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

.stage-item {
  background: linear-gradient(135deg, var(--card-bg), var(--card-bg-light));
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid rgba(74, 144, 217, 0.15);
  cursor: pointer;
  transition: all 0.2s ease;
}

.stage-item:active {
  transform: scale(0.98);
}

.stage-item.locked {
  opacity: 0.5;
  pointer-events: none;
}

.stage-info {
  flex: 1;
}

.stage-name {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 4px;
}

.stage-difficulty {
  font-size: 11px;
  color: var(--text-muted);
}

.stage-stamina {
  font-size: 12px;
  color: var(--secondary);
  margin-top: 2px;
}

.stage-stars {
  display: flex;
  gap: 2px;
  font-size: 16px;
  margin-right: 12px;
}

.stage-star-filled { color: var(--star-gold); }
.stage-star-empty { color: var(--text-muted); opacity: 0.3; }

.stage-action {
  display: flex;
  align-items: center;
}

.stage-locked-icon {
  font-size: 20px;
  color: var(--text-muted);
}

/* ===== 편성 화면 ===== */
.team-edit-container {
  padding: 16px;
}

.team-edit-container h2 {
  font-size: 20px;
  margin-bottom: 16px;
}

.team-edit-container h3 {
  font-size: 15px;
  color: var(--text-secondary);
  margin: 16px 0 12px;
}

.team-slots {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  justify-content: center;
}

.team-slot {
  width: 70px;
  height: 85px;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.team-slot:active {
  transform: scale(0.95);
}

.team-slot-inner {
  width: 100%;
  height: 100%;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 2px dashed rgba(74, 144, 217, 0.4);
  background: rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.team-slot-inner.empty .slot-label {
  font-size: 20px;
  color: var(--text-muted);
  font-weight: 700;
}

.team-slot-inner.filled {
  border-style: solid;
  border-color: var(--primary);
  background: var(--card-bg);
}

.team-slot-inner .slot-char-name {
  font-size: 10px;
  font-weight: 700;
  text-align: center;
  padding: 0 2px;
  margin-top: 4px;
}

.team-slot-inner .slot-char-sprite {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 14px;
}

.team-slot-inner .slot-char-pos {
  font-size: 8px;
  color: var(--text-muted);
  margin-top: 2px;
}

.team-edit-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 8px;
}

.team-char-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.team-char-card {
  background: var(--card-bg);
  border-radius: 10px;
  padding: 10px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s ease;
}

.team-char-card:active {
  transform: scale(0.95);
}

.team-char-card.selected {
  border-color: var(--secondary);
  box-shadow: 0 0 10px rgba(245, 166, 35, 0.3);
}

.team-char-card.in-team {
  opacity: 0.4;
}

.team-char-card .char-mini-sprite {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 16px;
}

.team-char-card .char-mini-name {
  font-size: 10px;
  font-weight: 600;
  text-align: center;
}

.team-char-card .char-mini-stars {
  font-size: 8px;
}

/* ===== 배틀 화면 ===== */
#screen-battle {
  padding-top: 0;
  top: 0;
  height: 100vh;
}

.battle-container {
  height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  background: linear-gradient(180deg, #0a1628 0%, #162040 30%, #1a2a50 60%, #0f1f3a 100%);
}

.battle-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: rgba(0, 0, 0, 0.5);
  z-index: 10;
}

.wave-indicator {
  font-size: 14px;
  font-weight: 700;
  color: var(--secondary);
  text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}

.battle-timer {
  font-size: 28px;
  font-weight: 900;
  color: var(--text-primary);
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  min-width: 50px;
  text-align: center;
}

.speed-controls {
  display: flex;
  gap: 4px;
}

.btn-speed {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-speed.active {
  background: var(--primary);
  border-color: var(--primary-light);
  color: white;
}

.battle-field {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  position: relative;
  min-height: 300px;
  overflow: hidden;
}

/* 배틀 필드 배경 라인 */
.battle-field::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  height: 1px;
  background: rgba(74, 144, 217, 0.1);
}

.player-side,
.enemy-side {
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1;
}

.player-side {
  align-items: flex-start;
}

.enemy-side {
  align-items: flex-end;
}

.unit-sprite {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform 0.15s ease;
}

.unit-sprite.attacking {
  animation: shake 0.3s ease;
}

.unit-sprite.hit {
  animation: shake 0.2s ease;
  filter: brightness(2);
}

.unit-body {
  width: 50px;
  height: 50px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 18px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
  position: relative;
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.unit-body.player-unit {
  border-color: rgba(74, 144, 217, 0.5);
  box-shadow: 0 0 10px rgba(74, 144, 217, 0.2);
}

.unit-body.enemy-unit {
  border-color: rgba(231, 76, 60, 0.5);
  box-shadow: 0 0 10px rgba(231, 76, 60, 0.2);
}

.unit-name-label {
  font-size: 9px;
  font-weight: 600;
  margin-bottom: 4px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
  white-space: nowrap;
}

.unit-bars {
  width: 54px;
  margin-top: 4px;
}

.hp-bar,
.tp-bar {
  width: 100%;
  height: 5px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 2px;
}

.hp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #4caf50, #8bc34a);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.hp-bar-fill.low {
  background: linear-gradient(90deg, #e74c3c, #f39c12);
}

.tp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #2196f3, #03a9f4);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.tp-bar-fill.full {
  background: linear-gradient(90deg, #ff9800, #ffc107);
  box-shadow: 0 0 6px rgba(255, 193, 7, 0.6);
}

/* 데미지 숫자 */
.damage-number {
  position: absolute;
  font-weight: 900;
  font-size: 18px;
  pointer-events: none;
  z-index: 50;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8), 0 0 6px rgba(0, 0, 0, 0.5);
  animation: damageFloat 1s ease-out forwards;
  white-space: nowrap;
}

.damage-number.physical {
  color: #ff6b6b;
}

.damage-number.magical {
  color: #a78bfa;
}

.damage-number.heal {
  color: #4ade80;
}

.damage-number.critical {
  font-size: 24px;
  color: #ffd700;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.6), 0 2px 4px rgba(0, 0, 0, 0.8);
}

/* 스킬 이름 표시 */
.skill-name-display {
  position: absolute;
  top: 45%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 20px;
  font-weight: 900;
  color: white;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
  z-index: 30;
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  letter-spacing: 2px;
}

.skill-name-display.show {
  animation: skillNamePop 1.2s ease forwards;
}

@keyframes skillNamePop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
  15% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
  30% { transform: translate(-50%, -50%) scale(1); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -60%) scale(1); }
}

/* UB 애니메이션 */
.ub-animation {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--game-max-width);
  height: 100vh;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  z-index: 60;
  pointer-events: none;
}

.ub-animation.show {
  display: flex;
  animation: skillFlash 1.5s ease forwards;
}

.ub-animation::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(255, 215, 0, 0.3) 0%, rgba(255, 215, 0, 0) 70%);
}

.ub-character-name {
  font-size: 28px;
  font-weight: 900;
  color: var(--secondary);
  text-shadow: 0 2px 15px rgba(245, 166, 35, 0.8), 0 0 30px rgba(245, 166, 35, 0.4);
  margin-bottom: 8px;
  letter-spacing: 4px;
  animation: ubTextIn 0.5s ease 0.2s both;
}

.ub-skill-name {
  font-size: 18px;
  font-weight: 700;
  color: white;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
  letter-spacing: 2px;
  animation: ubTextIn 0.5s ease 0.5s both;
}

@keyframes ubTextIn {
  0% { opacity: 0; transform: translateY(20px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* 배틀 로그 */
.battle-log {
  position: absolute;
  bottom: 70px;
  left: 10px;
  width: 200px;
  max-height: 80px;
  overflow: hidden;
  pointer-events: none;
  z-index: 5;
}

.battle-log-entry {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.5);
  padding: 1px 0;
  animation: fadeIn 0.3s ease;
}

.battle-controls {
  display: flex;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.5);
  z-index: 10;
}

/* ===== 아레나 화면 ===== */
.arena-container {
  padding: 16px;
}

.arena-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.arena-header h2 {
  font-size: 20px;
}

.arena-rank-display {
  text-align: right;
}

.arena-rank-label {
  font-size: 11px;
  color: var(--text-muted);
  display: block;
}

.arena-rank-value {
  font-size: 24px;
  font-weight: 900;
  color: var(--secondary);
  text-shadow: 0 1px 4px rgba(245, 166, 35, 0.3);
}

.arena-tickets {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  text-align: center;
  padding: 8px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
}

.arena-opponent-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.arena-opponent {
  background: linear-gradient(135deg, var(--card-bg), var(--card-bg-light));
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid rgba(74, 144, 217, 0.15);
}

.opponent-info {
  flex: 1;
}

.opponent-name {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 4px;
}

.opponent-power {
  font-size: 12px;
  color: var(--text-muted);
}

.opponent-rank {
  font-size: 18px;
  font-weight: 700;
  color: var(--secondary);
  margin-right: 16px;
  min-width: 60px;
  text-align: center;
}

.btn-arena-battle {
  padding: 8px 20px;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  border: 1px solid var(--accent-light);
  border-radius: 8px;
  color: white;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-arena-battle:active {
  transform: scale(0.95);
}

.arena-team-preview {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 12px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.arena-team-preview h3 {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.arena-my-team {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.arena-team-unit {
  width: 50px;
  text-align: center;
}

.arena-unit-sprite {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  margin: 0 auto 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 14px;
  border: 2px solid rgba(74, 144, 217, 0.3);
}

.arena-unit-name {
  font-size: 9px;
  color: var(--text-secondary);
}

/* ===== 캐릭터 목록 화면 ===== */
.character-list-container {
  padding: 16px;
}

.character-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 8px;
}

.character-list-header h2 {
  font-size: 20px;
}

.character-filter {
  display: flex;
  gap: 4px;
}

.filter-btn.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark)) !important;
  border-color: var(--primary-light) !important;
}

.character-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

/* 캐릭터 카드 (공통) */
.character-card {
  background: linear-gradient(135deg, var(--card-bg), var(--card-bg-light));
  border-radius: 12px;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.character-card:active {
  transform: scale(0.95);
}

.character-card.rarity-3 {
  border: 2px solid var(--rarity-3);
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.2);
}

.character-card.rarity-2 {
  border: 2px solid var(--rarity-2);
  box-shadow: 0 0 8px rgba(179, 102, 255, 0.15);
}

.character-card.rarity-1 {
  border: 2px solid var(--rarity-1);
}

.char-card-sprite {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 20px;
  margin-bottom: 6px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.char-card-name {
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 4px;
}

.char-card-stars {
  font-size: 10px;
  margin-bottom: 4px;
}

.char-card-stars .star-filled { color: var(--star-gold); }
.char-card-stars .star-empty { color: var(--text-muted); opacity: 0.3; }

.char-card-level {
  font-size: 10px;
  color: var(--text-secondary);
  background: rgba(0, 0, 0, 0.3);
  padding: 1px 8px;
  border-radius: 8px;
  margin-bottom: 2px;
}

.char-card-position {
  font-size: 9px;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
}

.position-front {
  background: rgba(231, 76, 60, 0.2);
  color: #e74c3c;
  border: 1px solid rgba(231, 76, 60, 0.3);
}

.position-middle {
  background: rgba(245, 166, 35, 0.2);
  color: var(--secondary);
  border: 1px solid rgba(245, 166, 35, 0.3);
}

.position-back {
  background: rgba(74, 144, 217, 0.2);
  color: var(--primary-light);
  border: 1px solid rgba(74, 144, 217, 0.3);
}

/* ===== 캐릭터 상세 화면 ===== */
.character-detail-container {
  padding: 16px;
}

.char-detail-portrait {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 44px;
  position: relative;
  text-shadow: 0 2px 6px rgba(0,0,0,0.5);
}

.char-detail-rarity {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  padding: 1px 8px;
  border-radius: 8px;
  font-weight: 700;
}

.char-detail-info {
  text-align: center;
  margin-bottom: 20px;
}

.char-detail-info h2 {
  font-size: 22px;
  margin-bottom: 6px;
}

.char-detail-stars {
  font-size: 18px;
  margin-bottom: 6px;
}

.char-detail-stars .star-filled { color: var(--star-gold); }
.char-detail-stars .star-empty { color: var(--text-muted); opacity: 0.3; }

.char-detail-position {
  display: inline-block;
  font-size: 12px;
  padding: 3px 12px;
  border-radius: 12px;
  font-weight: 600;
  margin-bottom: 4px;
}

.char-detail-level {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-top: 6px;
}

/* 스탯 */
.char-detail-stats {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-row {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
  gap: 10px;
}

.stat-row:last-child {
  margin-bottom: 0;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  min-width: 60px;
}

.stat-bar {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
}

.stat-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}

.stat-bar-fill.hp { background: linear-gradient(90deg, #4caf50, #8bc34a); }
.stat-bar-fill.atk { background: linear-gradient(90deg, #e74c3c, #ff6b6b); }
.stat-bar-fill.def { background: linear-gradient(90deg, #3498db, #5dade2); }
.stat-bar-fill.matk { background: linear-gradient(90deg, #9b59b6, #c39bd3); }
.stat-bar-fill.mdef { background: linear-gradient(90deg, #1abc9c, #48c9b0); }

.stat-value {
  font-size: 12px;
  font-weight: 700;
  min-width: 45px;
  text-align: right;
}

/* 스킬 */
.char-detail-skills {
  margin-bottom: 20px;
}

.char-detail-skills h3 {
  font-size: 16px;
  margin-bottom: 12px;
}

.skill-item {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.skill-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.skill-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary-light);
}

.skill-type {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
}

.skill-type-ub {
  background: rgba(245, 166, 35, 0.2);
  color: var(--secondary);
  border: 1px solid rgba(245, 166, 35, 0.3);
}

.skill-type-normal {
  background: rgba(74, 144, 217, 0.2);
  color: var(--primary-light);
  border: 1px solid rgba(74, 144, 217, 0.3);
}

.skill-type-ex {
  background: rgba(231, 76, 111, 0.2);
  color: var(--accent);
  border: 1px solid rgba(231, 76, 111, 0.3);
}

.skill-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.char-detail-actions {
  display: flex;
  gap: 10px;
}

.char-detail-actions .btn {
  flex: 1;
  padding: 12px;
}

/* ===== 결과 화면 ===== */
#screen-result {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--dark-bg) 0%, var(--dark-bg-2) 100%);
}

#screen-result.active {
  display: flex;
}

.result-container {
  width: 100%;
  padding: 24px;
  text-align: center;
}

.result-banner {
  margin-bottom: 30px;
}

.result-banner h2 {
  font-size: 36px;
  font-weight: 900;
  margin-bottom: 12px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.result-banner.win h2 {
  background: linear-gradient(135deg, var(--secondary), #ffe066);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.result-banner.lose h2 {
  color: var(--text-muted);
}

.result-stars {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.result-star {
  font-size: 32px;
  color: var(--text-muted);
  opacity: 0.3;
  transition: all 0.5s ease;
}

.result-star.earned {
  color: var(--star-gold);
  opacity: 1;
  filter: drop-shadow(0 0 6px rgba(255, 215, 0, 0.5));
  animation: starEarned 0.5s ease;
}

@keyframes starEarned {
  0% { transform: scale(0) rotate(-180deg); }
  60% { transform: scale(1.3) rotate(10deg); }
  100% { transform: scale(1) rotate(0deg); }
}

.result-rewards {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.result-rewards h3 {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.reward-list {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.reward-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.reward-icon {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.reward-amount {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.result-exp {
  margin-bottom: 24px;
}

.result-exp-bar {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 6px;
}

.result-exp-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--secondary), #ffe066);
  border-radius: 4px;
  transition: width 1s ease;
}

#result-exp-text {
  font-size: 13px;
  color: var(--secondary);
  font-weight: 600;
}

/* ===== 토스트 알림 ===== */
#toast-container {
  position: fixed;
  top: calc(var(--top-bar-height) + 10px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: calc(var(--game-max-width) - 32px);
  width: calc(100% - 32px);
}

.toast {
  background: rgba(15, 52, 96, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(74, 144, 217, 0.3);
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 13px;
  color: var(--text-primary);
  text-align: center;
  animation: slideDown 0.3s ease;
  pointer-events: auto;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.toast.toast-leaving {
  animation: slideUp 0.3s ease forwards;
}

/* ===== 모달 ===== */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--game-max-width);
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  z-index: 250;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.show {
  display: flex;
  animation: fadeIn 0.2s ease;
}

.modal-dialog {
  background: linear-gradient(135deg, var(--card-bg), var(--dark-bg-2));
  border-radius: 16px;
  padding: 24px;
  width: 100%;
  max-width: 360px;
  border: 1px solid rgba(74, 144, 217, 0.3);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  animation: slideUp 0.3s ease;
}

.modal-title {
  font-size: 18px;
  margin-bottom: 12px;
  text-align: center;
}

.modal-content {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 20px;
  text-align: center;
  line-height: 1.6;
}

.modal-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.modal-buttons .btn {
  min-width: 100px;
}

/* ===== 키프레임 애니메이션 ===== */

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes damageFloat {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  20% {
    transform: translateY(-15px) scale(1.2);
  }
  100% {
    opacity: 0;
    transform: translateY(-50px) scale(0.8);
  }
}

@keyframes skillFlash {
  0% {
    opacity: 0;
    background: rgba(255, 215, 0, 0);
  }
  10% {
    opacity: 1;
    background: rgba(255, 215, 0, 0.3);
  }
  30% {
    background: rgba(255, 215, 0, 0.05);
  }
  80% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    background: rgba(255, 215, 0, 0);
  }
}

@keyframes cardReveal {
  0% {
    opacity: 0;
    transform: rotateY(90deg) scale(0.5);
  }
  50% {
    opacity: 1;
    transform: rotateY(0deg) scale(1.1);
  }
  70% {
    transform: rotateY(0deg) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: rotateY(0deg) scale(1);
  }
}

@keyframes sparkle {
  0%, 100% {
    opacity: 0;
    transform: scale(0);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes pulse {
  0%, 100% {
    box-shadow: 0 4px 15px rgba(245, 166, 35, 0.4);
  }
  50% {
    box-shadow: 0 4px 25px rgba(245, 166, 35, 0.7);
  }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}

@keyframes screenSlideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes screenSlideOut {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(-100%); opacity: 0; }
}

@keyframes glow {
  0%, 100% { filter: drop-shadow(0 0 4px currentColor); }
  50% { filter: drop-shadow(0 0 10px currentColor); }
}

/* ===== 반응형 ===== */
@media (max-width: 480px) {
  #game-container {
    max-width: 100%;
    box-shadow: none;
  }

  #top-bar,
  #bottom-nav {
    max-width: 100%;
  }

  .gacha-result-overlay {
    max-width: 100%;
  }

  .ub-animation,
  .modal-overlay {
    max-width: 100%;
  }
}

@media (min-width: 481px) {
  body {
    background: #0a0a14;
  }

  body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
      radial-gradient(ellipse at 20% 50%, rgba(74, 144, 217, 0.05) 0%, transparent 50%),
      radial-gradient(ellipse at 80% 50%, rgba(231, 76, 111, 0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
  }
}

/* ===== 유틸리티 ===== */
.hidden {
  display: none !important;
}

.text-gold { color: var(--rarity-3); }
.text-purple { color: var(--rarity-2); }
.text-blue { color: var(--rarity-1); }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent); }

.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.text-center { text-align: center; }
