/* =================================================================
   클업 (CLASS UP) - 게임 스타일 학급경영 앱
   ================================================================= */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

:root {
  /* === 다크 판타지 RPG 팔레트 === */
  --primary: #c9a14a;           /* 금색 (메인 강조) */
  --primary-light: #f0d77a;     /* 밝은 금 */
  --primary-dark: #7a5e1f;      /* 어두운 금 */
  --accent: #f3c761;            /* 빛나는 금 */
  --accent-2: #c084fc;          /* 마법 보라 */

  /* 다크 배경 (남색~자주색) */
  --bg-grad-1: #1a1535;         /* 어두운 남색 */
  --bg-grad-2: #2a1a4a;         /* 어두운 자주 */
  --bg-grad-3: #0e0a23;         /* 더 깊은 남색 */
  --bg-base: #0a0818;           /* 베이스 (거의 흑) */

  /* 등급 배지 (금속/보석 톤) */
  --bronze: #b87333;
  --bronze-light: #e8a878;
  --bronze-dark: #6b3f15;
  --silver: #b9c3cd;
  --silver-light: #e6ecf2;
  --silver-dark: #5a6772;
  --gold: #f3c761;
  --gold-light: #fde68a;
  --gold-dark: #8a6512;

  /* HP/MP */
  --hp-red: #ff4d4d;            /* 보석 같은 빨강 */
  --hp-gray: #2a2545;           /* 빈 하트 (다크 보라) */
  --mp-blue: #6ab7ff;

  /* 상태 색 */
  --success: #4ade80;
  --danger: #ff5577;
  --warning: #fbbf24;
  --info: #7dd3fc;

  /* 텍스트 (밝은 톤) */
  --text: #f5e9c8;              /* 양피지 아이보리 */
  --text-light: #b8a982;        /* 어두운 양피지 */
  --text-dim: #8a7d5f;

  /* 카드 (어두운 금테 인벤토리 슬롯) */
  --card-bg: linear-gradient(160deg, #2a2148 0%, #1a1535 60%, #110a2a 100%);
  --card-border: #c9a14a;
  --card-border-dim: #6e5526;

  --shadow: 0 4px 14px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(201, 161, 74, 0.18);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.65), 0 0 24px rgba(201, 161, 74, 0.22);
  --glow-gold: 0 0 12px rgba(243, 199, 97, 0.55);
}

html, body {
  width: 100%;
  min-height: 100vh;
  font-family: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont,
               'Apple SD Gothic Neo', 'Segoe UI', 'Noto Sans KR', system-ui, sans-serif;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  color: var(--text);
  background:
    /* 가장자리 비네팅 */
    radial-gradient(ellipse at top, var(--bg-grad-2) 0%, transparent 55%),
    radial-gradient(ellipse at bottom, var(--bg-grad-1) 0%, transparent 60%),
    radial-gradient(circle at 50% 30%, rgba(192, 132, 252, 0.08) 0%, transparent 40%),
    var(--bg-base);
  background-attachment: fixed;
  overflow-x: hidden;
  position: relative;
}

/* 미세한 노이즈/별 텍스처 (양피지+밤하늘 느낌) */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    radial-gradient(1px 1px at 12% 18%, rgba(243,199,97,0.35), transparent 50%),
    radial-gradient(1px 1px at 78% 32%, rgba(255,255,255,0.18), transparent 50%),
    radial-gradient(1px 1px at 45% 70%, rgba(192,132,252,0.25), transparent 50%),
    radial-gradient(1px 1px at 88% 82%, rgba(243,199,97,0.22), transparent 50%),
    radial-gradient(1px 1px at 22% 92%, rgba(255,255,255,0.15), transparent 50%);
  opacity: 0.6;
}

#app { position: relative; z-index: 1; }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
  padding-bottom: 32px;
}

/* ===== 헤더 ===== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background:
    linear-gradient(180deg, #1a0f3a 0%, #0e0925 100%);
  color: var(--text);
  padding: 14px 16px;
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.6),
    inset 0 -1px 0 var(--card-border);
  border-bottom: 2px solid var(--card-border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.header-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 20px;
  font-weight: bold;
  cursor: pointer;
  flex: 1;
  min-width: 0;
}

.header-title-back {
  display: flex;
  align-items: center;
  gap: 6px;
}

.logo-icon {
  font-size: 24px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

/* 브랜드 표기: 클업 + CLASS UP */
#header-title-text {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  line-height: 1;
}

.brand-ko {
  font-family: 'Nanum Myeongjo', 'Jua', serif;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(180deg, #fde68a 0%, #f3c761 45%, #b8862a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 18px rgba(243, 199, 97, 0.35);
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.4));
}

.brand-en {
  font-family: 'Cinzel', serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  padding: 3px 8px;
  color: var(--gold-light);
  background: rgba(201, 161, 74, 0.12);
  border: 1px solid var(--card-border-dim);
  border-radius: 4px;
  text-transform: uppercase;
  white-space: nowrap;
}

.header-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.icon-btn {
  min-width: 52px;
  height: 46px;
  padding: 5px 8px 4px;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(201,161,74,0.18), rgba(201,161,74,0.05));
  color: var(--gold-light);
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  transition: transform 0.15s, background 0.15s, box-shadow 0.15s, border-color 0.15s;
  border: 1px solid var(--card-border-dim);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
  cursor: pointer;
  font-family: inherit;
}

.icon-btn i {
  font-size: 16px;
  line-height: 1;
}

.icon-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--gold-light);
  line-height: 1;
  opacity: 0.95;
}

.icon-btn:hover {
  background: linear-gradient(180deg, rgba(201,161,74,0.28), rgba(201,161,74,0.10));
  border-color: var(--gold);
}

.icon-btn:active {
  transform: scale(0.94);
  background: linear-gradient(180deg, rgba(201,161,74,0.35), rgba(201,161,74,0.15));
  box-shadow: var(--glow-gold);
}

/* 로그아웃은 살짝 다른 톤(붉은 기) */
.icon-btn-logout {
  background: linear-gradient(180deg, rgba(220, 80, 80, 0.18), rgba(220, 80, 80, 0.05));
  border-color: rgba(220, 80, 80, 0.35);
  color: #fca5a5;
}
.icon-btn-logout i,
.icon-btn-logout .icon-label {
  color: #fca5a5;
}
.icon-btn-logout:hover {
  background: linear-gradient(180deg, rgba(220, 80, 80, 0.28), rgba(220, 80, 80, 0.10));
  border-color: #fca5a5;
}

/* 좁은 화면에서는 라벨이 잘리지 않도록 헤더 패딩 조정 */
@media (max-width: 360px) {
  .app-header { padding: 12px 10px; }
  .icon-btn { min-width: 46px; padding: 5px 6px 4px; }
  .icon-label { font-size: 9px; }
}

/* ===== 공통 컨테이너 ===== */
.view-container {
  padding: 16px;
  animation: fadeIn 0.25s ease-out;
}

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

.view-title {
  font-family: 'Nanum Myeongjo', serif;
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 14px;
  color: var(--gold-light);
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6), 0 0 10px rgba(243, 199, 97, 0.25);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ===== 학생 카드 그리드 (화면 1) ===== */
.student-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.student-card {
  background: var(--card-bg);
  border-radius: 14px;
  padding: 14px 10px 12px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: transform 0.15s, box-shadow 0.15s;
  position: relative;
  cursor: pointer;
  border: 2px solid var(--card-border-dim);
  overflow: hidden;
}

/* 인벤토리 슬롯 코너 장식 */
.student-card::before,
.student-card::after {
  content: '';
  position: absolute;
  width: 10px;
  height: 10px;
  border: 2px solid var(--gold);
  pointer-events: none;
  opacity: 0.85;
}
.student-card::before {
  top: 3px; left: 3px;
  border-right: none;
  border-bottom: none;
}
.student-card::after {
  bottom: 3px; right: 3px;
  border-left: none;
  border-top: none;
}

.student-card:active {
  transform: scale(0.96);
  box-shadow: var(--shadow-lg);
  border-color: var(--gold);
}

.student-card.has-pending {
  border-color: var(--gold);
  animation: pulse-border 1.6s infinite;
}

@keyframes pulse-border {
  0%, 100% {
    border-color: var(--gold);
    box-shadow: var(--shadow), 0 0 0 0 rgba(243, 199, 97, 0.5);
  }
  50% {
    border-color: var(--accent-2);
    box-shadow: var(--shadow), 0 0 0 4px rgba(192, 132, 252, 0.35), 0 0 18px rgba(243, 199, 97, 0.6);
  }
}

.pending-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: linear-gradient(180deg, #fde68a, #c9a14a 60%, #7a5e1f);
  color: #2a1500;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 8px;
  font-weight: 800;
  box-shadow: 0 2px 6px rgba(0,0,0,0.6), 0 0 12px rgba(243, 199, 97, 0.6);
  border: 1px solid #7a5e1f;
  animation: bounce 1s infinite;
  z-index: 2;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

.avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 24px;
  font-weight: bold;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  position: relative;
}

/* 이모지 아바타는 텍스트 그림자 제거 + 살짝 큰 폰트 */
.avatar.avatar-emoji {
  text-shadow: none;
  font-size: 32px;
}

.avatar-lg {
  width: 88px;
  height: 88px;
  font-size: 34px;
}

.avatar-lg.avatar-emoji {
  font-size: 48px;
}

/* 닉네임/본명 표시 */
.display-name {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  text-align: center;
  min-width: 0;
  width: 100%;
}

.display-name .nickname {
  font-size: 15px;
  font-weight: bold;
  color: var(--gold-light);
  text-shadow: 0 1px 2px rgba(0,0,0,0.7);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.display-name .real-name {
  font-size: 11px;
  color: var(--text-light);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.display-name.sm .nickname { font-size: 14px; }
.display-name.sm .real-name { font-size: 10px; }

.level-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}

.level-pill {
  background: linear-gradient(180deg, #2a1a4a, #110a2a);
  color: var(--gold-light);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 800;
  border: 1px solid var(--card-border-dim);
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
  letter-spacing: 0.5px;
}

.rank-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.3px;
  box-shadow:
    0 2px 6px rgba(0,0,0,0.5),
    inset 0 1px 0 rgba(255,255,255,0.4),
    inset 0 -1px 0 rgba(0,0,0,0.3);
  text-shadow: 0 1px 1px rgba(0,0,0,0.4);
  position: relative;
}

.rank-bronze {
  background: linear-gradient(180deg, #e8a878 0%, #b87333 50%, #6b3f15 100%);
  color: #fff5e0;
  border: 1px solid #6b3f15;
}
.rank-silver {
  background: linear-gradient(180deg, #e6ecf2 0%, #b9c3cd 50%, #5a6772 100%);
  color: #1a1f28;
  border: 1px solid #5a6772;
}
.rank-gold {
  background: linear-gradient(180deg, #fde68a 0%, #f3c761 45%, #8a6512 100%);
  color: #3a2700;
  border: 1px solid #6b4d10;
  box-shadow:
    0 2px 6px rgba(0,0,0,0.5),
    inset 0 1px 0 rgba(255,255,255,0.5),
    inset 0 -1px 0 rgba(0,0,0,0.3),
    0 0 14px rgba(243, 199, 97, 0.5);
}

.skill-count {
  font-size: 11px;
  color: var(--text-light);
  display: flex;
  gap: 4px;
  align-items: center;
}
.skill-count i { color: var(--gold); }

/* ===== 학생 상세 (화면 2) ===== */
.detail-hero {
  background:
    radial-gradient(ellipse at top, rgba(192, 132, 252, 0.18) 0%, transparent 60%),
    linear-gradient(160deg, #2a2148 0%, #1a1535 50%, #110a2a 100%);
  border-radius: 16px;
  padding: 22px 16px 16px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  position: relative;
  overflow: hidden;
  border: 2px solid var(--card-border);
}

.detail-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(243, 199, 97, 0.2) 0%, transparent 60%);
  pointer-events: none;
}

/* 인벤토리 코너 장식 (4구석) */
.detail-hero > .corner {
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid var(--gold);
  z-index: 2;
  pointer-events: none;
}

.detail-name {
  font-size: 24px;
  font-weight: bold;
  color: var(--primary-dark);
  z-index: 1;
}

/* 상세 화면 닉네임/본명 영역 */
.detail-name-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  z-index: 1;
}

.detail-nickname {
  font-family: 'Nanum Myeongjo', serif;
  font-size: 24px;
  font-weight: 800;
  background: linear-gradient(180deg, #fde68a 0%, #f3c761 50%, #b8862a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 16px rgba(243, 199, 97, 0.3);
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.5));
  line-height: 1.1;
}

.detail-realname {
  font-size: 13px;
  color: var(--text-light);
  font-weight: bold;
}

.detail-realname-empty {
  font-size: 12px;
  color: #cbd5e1;
  font-style: italic;
}

.btn-edit-nickname {
  margin-top: 4px;
  padding: 4px 10px;
  background: rgba(201, 161, 74, 0.12);
  color: var(--gold-light);
  border-radius: 6px;
  border: 1px solid var(--card-border-dim);
  font-size: 11px;
  font-weight: bold;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-edit-nickname:active { transform: scale(0.94); background: rgba(201, 161, 74, 0.25); }

/* 아바타 위 편집 아이콘 (상세 헤로 전용) */
.detail-hero .avatar-lg {
  border: none;
  cursor: pointer;
}

.avatar-edit-icon {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(180deg, #fde68a, #c9a14a);
  color: #2a1500;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6), 0 0 8px rgba(243, 199, 97, 0.4);
  text-shadow: none;
  border: 2px solid #7a5e1f;
}

.detail-badges {
  display: flex;
  gap: 8px;
  z-index: 1;
}

/* HP 하트 */
.hp-row {
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 1;
}

.hp-label {
  font-size: 13px;
  color: var(--text-light);
  font-weight: bold;
}

.hp-hearts {
  display: flex;
  gap: 4px;
}

.heart {
  font-size: 26px;
  transition: transform 0.2s, filter 0.2s;
}

.heart.full {
  color: var(--hp-red);
  filter: drop-shadow(0 0 8px rgba(255, 77, 77, 0.7)) drop-shadow(0 2px 3px rgba(0,0,0,0.5));
}
.heart.empty {
  color: var(--hp-gray);
  filter: drop-shadow(0 2px 3px rgba(0,0,0,0.5));
  opacity: 0.7;
}

.heart:active { transform: scale(1.2); }

.hp-controls {
  display: flex;
  gap: 4px;
  margin-left: 4px;
}

.hp-controls button {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: linear-gradient(180deg, rgba(255,77,77,0.18), rgba(255,77,77,0.05));
  color: var(--hp-red);
  font-weight: bold;
  font-size: 14px;
  border: 1px solid rgba(255, 77, 77, 0.4);
}

.hp-controls button:active { transform: scale(0.9); }

/* XP 바 */
.xp-section {
  width: 100%;
  z-index: 1;
}

.xp-info {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 6px;
  color: var(--text-light);
  font-weight: bold;
}

.xp-info .xp-current {
  color: var(--gold-light);
  font-size: 14px;
  text-shadow: 0 0 8px rgba(243, 199, 97, 0.5);
}

.xp-bar-bg {
  width: 100%;
  height: 16px;
  background: linear-gradient(180deg, #0a0518 0%, #1a1030 100%);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
  box-shadow:
    inset 0 2px 4px rgba(0,0,0,0.8),
    0 0 0 1px var(--card-border-dim);
  border: 1px solid var(--card-border);
}

.xp-bar-fg {
  height: 100%;
  background:
    linear-gradient(180deg, #fde68a 0%, #f3c761 30%, #c9a14a 70%, #7a5e1f 100%);
  border-radius: 2px;
  transition: width 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  box-shadow:
    0 0 12px rgba(243, 199, 97, 0.85),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.xp-bar-fg::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.6), transparent 40%, transparent 60%, rgba(0,0,0,0.2));
  border-radius: 2px;
}

/* 마나 흐르는 애니메이션 */
.xp-bar-fg::before {
  content: '';
  position: absolute;
  top: 0; left: -100%; right: 0; bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.5), transparent);
  animation: xp-shimmer 2.5s infinite;
}

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

/* 섹션 카드 (인벤토리 패널) */
.section-card {
  background: var(--card-bg);
  border-radius: 14px;
  padding: 16px 14px 14px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
  border: 1.5px solid var(--card-border-dim);
  position: relative;
}

.section-title {
  font-family: 'Nanum Myeongjo', serif;
  font-size: 16px;
  font-weight: 800;
  color: var(--gold-light);
  text-shadow: 0 1px 3px rgba(0,0,0,0.7);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--card-border-dim);
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.3px;
}

.section-title .count-pill {
  background: linear-gradient(180deg, #fde68a, #c9a14a);
  color: #2a1500;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 800;
  border: 1px solid #7a5e1f;
  box-shadow: 0 0 8px rgba(243, 199, 97, 0.3);
}

/* 점수 버튼 그리드 */
.score-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.score-btn {
  padding: 12px 8px;
  border-radius: 10px;
  background: linear-gradient(180deg, #2a2148 0%, #1a1535 100%);
  border: 2px solid var(--card-border-dim);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: transform 0.1s, box-shadow 0.1s, border-color 0.15s;
  position: relative;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

.score-btn:active {
  transform: scale(0.94);
  border-color: var(--gold);
  box-shadow: var(--glow-gold), inset 0 1px 0 rgba(255,255,255,0.04);
}

.score-btn .emoji {
  font-size: 26px;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,0.5));
}
.score-btn .label {
  font-size: 13px;
  font-weight: bold;
  color: var(--text);
}
.score-btn .delta {
  font-size: 12px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid transparent;
}

.delta-pos {
  background: linear-gradient(180deg, rgba(74,222,128,0.25), rgba(74,222,128,0.08));
  color: #86efac;
  border-color: rgba(74,222,128,0.4);
  text-shadow: 0 0 6px rgba(74,222,128,0.4);
}
.delta-neg {
  background: linear-gradient(180deg, rgba(255,85,119,0.25), rgba(255,85,119,0.08));
  color: #fda4af;
  border-color: rgba(255,85,119,0.4);
  text-shadow: 0 0 6px rgba(255,85,119,0.4);
}

.score-btn.positive { border-color: rgba(74,222,128,0.3); }
.score-btn.positive:active {
  border-color: #4ade80;
  box-shadow: 0 0 12px rgba(74,222,128,0.5), inset 0 1px 0 rgba(255,255,255,0.04);
}
.score-btn.negative { border-color: rgba(255,85,119,0.3); }
.score-btn.negative:active {
  border-color: #ff5577;
  box-shadow: 0 0 12px rgba(255,85,119,0.5), inset 0 1px 0 rgba(255,255,255,0.04);
}

/* 스킬 카드 */
.passive-card {
  background: linear-gradient(135deg, rgba(192,132,252,0.18) 0%, rgba(192,132,252,0.05) 100%), linear-gradient(180deg, #2a2148, #1a1535);
  border: 1.5px solid rgba(192, 132, 252, 0.5);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 0 12px rgba(192, 132, 252, 0.15), inset 0 1px 0 rgba(255,255,255,0.05);
}

.passive-icon {
  font-size: 24px;
  width: 40px;
  height: 40px;
  background: linear-gradient(180deg, #2a1a4a, #0e0a23);
  border: 1px solid var(--accent-2);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.5), 0 0 8px rgba(192,132,252,0.3);
}

.passive-info { flex: 1; }
.passive-label {
  font-size: 11px;
  color: #c4b5fd;
  font-weight: bold;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.passive-name {
  font-size: 15px;
  font-weight: bold;
  color: var(--text);
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}

.skill-list {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: 8px;
}

.skill-card {
  background: linear-gradient(135deg, rgba(243,199,97,0.15) 0%, rgba(243,199,97,0.03) 100%), linear-gradient(180deg, #2a2148, #1a1535);
  border: 1.5px solid var(--card-border-dim);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}

.skill-card .skill-icon {
  font-size: 24px;
  width: 40px;
  height: 40px;
  background: linear-gradient(180deg, #2a1a4a, #0e0a23);
  border: 1px solid var(--gold);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.5), 0 0 8px rgba(243,199,97,0.3);
}

.skill-card .skill-info { flex: 1; min-width: 0; }
.skill-card .skill-name {
  font-size: 14px;
  font-weight: bold;
  color: var(--gold-light);
  text-shadow: 0 1px 2px rgba(0,0,0,0.7);
}
.skill-card .skill-source {
  font-size: 11px;
  color: var(--text-dim);
}

.use-btn {
  background: linear-gradient(180deg, #fde68a 0%, #c9a14a 50%, #7a5e1f 100%);
  color: #2a1500;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 800;
  border: 1px solid #7a5e1f;
  box-shadow:
    0 3px 6px rgba(0,0,0,0.5),
    inset 0 1px 0 rgba(255,255,255,0.5),
    0 0 10px rgba(243, 199, 97, 0.35);
  letter-spacing: 0.5px;
}

.use-btn:active {
  transform: scale(0.92);
  box-shadow: 0 1px 3px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.3);
}

.empty-state {
  text-align: center;
  padding: 20px;
  color: var(--text-light);
  font-size: 13px;
}

/* 선택 대기 카드 */
.choice-card {
  background:
    radial-gradient(ellipse at top, rgba(243, 199, 97, 0.25) 0%, transparent 60%),
    linear-gradient(160deg, #3a2a5e 0%, #2a1a4a 60%, #1a0f3a 100%);
  border: 2px solid var(--gold);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.6), 0 0 18px rgba(243, 199, 97, 0.35);
  margin-bottom: 14px;
  animation: glow-pulse 1.8s infinite;
  position: relative;
}

@keyframes glow-pulse {
  0%, 100% { box-shadow: 0 6px 18px rgba(0,0,0,0.6), 0 0 18px rgba(243, 199, 97, 0.35); }
  50% { box-shadow: 0 6px 24px rgba(0,0,0,0.6), 0 0 28px rgba(243, 199, 97, 0.75); }
}

.choice-title {
  font-family: 'Nanum Myeongjo', serif;
  font-size: 17px;
  font-weight: 800;
  color: var(--gold-light);
  text-shadow: 0 2px 4px rgba(0,0,0,0.8), 0 0 12px rgba(243, 199, 97, 0.5);
  text-align: center;
  margin-bottom: 4px;
}

.choice-sub {
  font-size: 12px;
  color: var(--text-light);
  text-align: center;
  margin-bottom: 12px;
}

.choice-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.choice-option {
  background: linear-gradient(180deg, #2a2148, #1a1535);
  border: 1.5px solid var(--card-border-dim);
  border-radius: 10px;
  padding: 14px 10px;
  font-weight: bold;
  font-size: 14px;
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: transform 0.1s, border-color 0.15s, box-shadow 0.15s;
}

.choice-option:active {
  transform: scale(0.94);
  border-color: var(--gold);
  box-shadow: var(--glow-gold);
}

.choice-option .opt-label {
  background: linear-gradient(180deg, #fde68a, #c9a14a);
  color: #2a1500;
  font-size: 12px;
  padding: 2px 10px;
  border-radius: 4px;
  border: 1px solid #7a5e1f;
  font-weight: 800;
}

/* ===== 활동 기록 (화면 3) ===== */
.log-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.log-item {
  background: var(--card-bg);
  border-radius: 14px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}

.log-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  font-size: 14px;
  flex-shrink: 0;
}

.log-content { flex: 1; min-width: 0; }
.log-line1 {
  font-size: 13px;
  font-weight: bold;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.log-name { color: var(--primary); }
.log-activity { color: var(--text); }
.log-time { font-size: 11px; color: var(--text-light); margin-top: 2px; }

.log-delta {
  font-size: 13px;
  font-weight: bold;
  padding: 3px 8px;
  border-radius: 8px;
  flex-shrink: 0;
}

.log-type-icon { font-size: 14px; }

/* ===== 설정 (화면 4) ===== */
.level-edit-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.level-edit-item {
  background: var(--card-bg);
  border-radius: 14px;
  padding: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.level-edit-num {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #7c3aed, #a78bfa);
  color: white;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 11px;
  flex-shrink: 0;
}

.level-edit-num .lv-big { font-size: 16px; line-height: 1; }

.level-edit-body { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }

.level-edit-row {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.level-edit-row label {
  font-size: 11px;
  color: var(--text-light);
  font-weight: bold;
  min-width: 50px;
}

.level-edit-row input, .level-edit-row select {
  flex: 1;
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  background: #fafafa;
}

.level-edit-row input:focus, .level-edit-row select:focus {
  outline: none;
  border-color: var(--primary);
  background: white;
}

.level-edit-actions {
  display: flex;
  gap: 4px;
}

.btn-mini {
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: bold;
  background: #f3f4f6;
  color: var(--text);
}

.btn-mini.danger { background: #fee2e2; color: #b91c1c; }
.btn-mini.primary { background: var(--primary); color: white; }

.btn-add-level {
  padding: 14px;
  background: white;
  border: 2px dashed var(--primary-light);
  border-radius: 14px;
  width: 100%;
  font-weight: bold;
  color: var(--primary);
  font-size: 14px;
  margin-top: 4px;
}

.btn-add-level:active { background: #f5f3ff; }

.checkbox-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.checkbox-wrap input { width: auto; flex: none; }

/* ===== 토스트 ===== */
#toast-container {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: calc(100% - 32px);
  max-width: 400px;
}

.toast {
  background: linear-gradient(160deg, #2a2148 0%, #1a1535 60%, #110a2a 100%);
  color: var(--text);
  border-radius: 10px;
  padding: 12px 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.7), inset 0 1px 0 rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
  animation: toast-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: 1.5px solid var(--card-border);
  border-left: 4px solid var(--gold);
  font-weight: bold;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.toast.success {
  border-left-color: var(--success);
  box-shadow: 0 8px 24px rgba(0,0,0,0.7), 0 0 14px rgba(74,222,128,0.25);
}
.toast.warning { border-left-color: var(--warning); }
.toast.error {
  border-left-color: var(--danger);
  box-shadow: 0 8px 24px rgba(0,0,0,0.7), 0 0 14px rgba(255,85,119,0.25);
}
.toast.level-up {
  border: 2px solid var(--gold);
  background:
    radial-gradient(ellipse at top, rgba(243,199,97,0.3) 0%, transparent 70%),
    linear-gradient(160deg, #3a2a5e 0%, #2a1a4a 60%, #1a0f3a 100%);
  color: var(--gold-light);
  box-shadow: 0 8px 24px rgba(0,0,0,0.7), 0 0 20px rgba(243,199,97,0.6);
  font-family: 'Nanum Myeongjo', serif;
}

.toast .toast-emoji { font-size: 22px; }
.toast .toast-text { flex: 1; font-size: 14px; }

/* ===== 모달 ===== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s;
}

.modal {
  background: white;
  border-radius: 22px;
  padding: 20px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.3);
  animation: toast-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-title {
  font-size: 18px;
  font-weight: bold;
  color: var(--primary-dark);
  text-align: center;
  margin-bottom: 12px;
}

.modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.modal-actions button {
  flex: 1;
  padding: 12px;
  border-radius: 12px;
  font-weight: bold;
  font-size: 14px;
}

.modal-actions .btn-cancel { background: #f3f4f6; color: var(--text); }
.modal-actions .btn-confirm { background: var(--primary); color: white; }

/* 와이드 모달 (아바타 꾸미기) */
.modal-wide {
  max-width: 380px;
  max-height: 90vh;
  overflow-y: auto;
}

.avatar-preview-wrap {
  display: flex;
  justify-content: center;
  margin: 8px 0 14px;
}

.picker-section {
  margin-bottom: 14px;
}

.picker-label {
  font-size: 12px;
  font-weight: bold;
  color: var(--text-light);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

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

.emoji-pick {
  aspect-ratio: 1;
  border-radius: 10px;
  background: #f9fafb;
  border: 2px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  transition: transform 0.1s, border-color 0.1s;
}

.emoji-pick:active { transform: scale(0.9); }
.emoji-pick.active {
  border-color: var(--primary);
  background: #f5f3ff;
  box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.15);
}

.color-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
}

.color-pick {
  aspect-ratio: 1;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: transform 0.1s, border-color 0.1s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.color-pick:active { transform: scale(0.85); }
.color-pick.active {
  border-color: var(--text);
  transform: scale(1.1);
  box-shadow: 0 0 0 2px white, 0 0 0 4px var(--primary);
}

/* ===== 헤더 뒤로가기 화살표 ===== */
.back-arrow {
  font-size: 18px;
  width: 26px;
  display: inline-block;
}

/* ===== 작은 안내 텍스트 ===== */
.hint-text {
  font-size: 12px;
  color: var(--text-light);
  text-align: center;
  padding: 8px;
}

/* ===== 설정 탭 ===== */
.settings-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  background: white;
  padding: 4px;
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.settings-tab {
  flex: 1;
  padding: 10px 8px;
  border-radius: 10px;
  font-weight: bold;
  font-size: 14px;
  color: var(--text-light);
  background: transparent;
  transition: all 0.15s;
}

.settings-tab.active {
  background: linear-gradient(135deg, #7c3aed, #a78bfa);
  color: white;
  box-shadow: 0 2px 6px rgba(124, 58, 237, 0.3);
}

.settings-tab:active { transform: scale(0.96); }

/* 활동 점수 편집 */
.activity-edit-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.activity-edit-item {
  background: white;
  border-radius: 14px;
  padding: 10px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
  display: flex;
  gap: 6px;
  align-items: center;
}

.activity-edit-item.custom {
  background: linear-gradient(135deg, #ede9fe, #ddd6fe);
  border: 2px solid #c4b5fd;
}

.activity-edit-item .f-emoji {
  width: 44px;
  text-align: center;
  font-size: 18px;
  padding: 8px 0;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fafafa;
  font-family: inherit;
  flex-shrink: 0;
}

.activity-edit-item .f-name {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  font-weight: bold;
  background: #fafafa;
}

.activity-edit-item .f-delta {
  width: 64px;
  padding: 8px 6px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  font-weight: bold;
  background: #fafafa;
  text-align: center;
  flex-shrink: 0;
}

.activity-edit-item input:focus {
  outline: none;
  border-color: var(--primary);
  background: white;
}

.activity-edit-item .custom-badge {
  flex: 0 0 auto;
  background: var(--primary);
  color: white;
  font-size: 11px;
  padding: 6px 10px;
  border-radius: 8px;
  font-weight: bold;
  white-space: nowrap;
}

/* 스킬 내용 편집 */
.skill-edit-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.skill-edit-item {
  background: white;
  border-radius: 14px;
  padding: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
  border-left: 4px solid #fbbf24;
}

.skill-edit-item.choice {
  border-left-color: #f97316;
  background: linear-gradient(135deg, #fff, #fef3c7);
}

.skill-edit-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.unlock-tag {
  background: #fef3c7;
  color: #92400e;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 8px;
  font-weight: bold;
}

.choice-tag {
  background: #f97316;
  color: white;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 8px;
  font-weight: bold;
}

.skill-edit-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.skill-edit-row label {
  font-size: 12px;
  color: var(--text-light);
  font-weight: bold;
  min-width: 64px;
  flex-shrink: 0;
}

.skill-edit-row input {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  background: #fafafa;
}

.skill-edit-row input:focus {
  outline: none;
  border-color: var(--primary);
  background: white;
}

/* iOS 안전영역 */
@supports (padding: max(0px)) {
  .app-header { padding-top: max(14px, env(safe-area-inset-top)); }
}

/* =============================================================================
   인증 (로그인 / 회원가입) 화면
   ============================================================================= */
.auth-screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: radial-gradient(ellipse at top, rgba(167, 139, 250, 0.12) 0%, transparent 55%),
              radial-gradient(ellipse at bottom, rgba(251, 191, 36, 0.08) 0%, transparent 55%),
              var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: linear-gradient(145deg, var(--card-bg) 0%, var(--card-bg-2) 100%);
  border: 1.5px solid var(--gold-soft);
  border-radius: 18px;
  padding: 32px 24px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6),
              0 0 0 1px rgba(251, 191, 36, 0.15),
              inset 0 1px 0 rgba(255,255,255,0.05);
}

.auth-brand {
  text-align: center;
  margin-bottom: 28px;
}

.auth-logo {
  font-size: 56px;
  line-height: 1;
  margin-bottom: 10px;
  filter: drop-shadow(0 0 12px rgba(251, 191, 36, 0.4));
}

.auth-brand-name {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  margin-bottom: 4px;
}

.auth-brand-name .brand-ko {
  font-family: 'Nanum Myeongjo', serif;
  font-weight: 800;
  font-size: 32px;
  color: var(--gold);
  text-shadow: 0 0 18px rgba(251, 191, 36, 0.5);
  letter-spacing: 1px;
}

.auth-brand-name .brand-en {
  font-family: 'Cinzel', serif;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-light);
  letter-spacing: 3px;
}

.auth-tagline {
  font-size: 13px;
  color: var(--text-light);
  letter-spacing: 1px;
}

.auth-tabs {
  display: flex;
  background: rgba(0,0,0,0.25);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 22px;
  border: 1px solid var(--border);
}

.auth-tab {
  flex: 1;
  padding: 10px 12px;
  background: transparent;
  border: none;
  color: var(--text-light);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}

.auth-tab.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: 0 4px 12px rgba(167, 139, 250, 0.4);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-label > span {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.3px;
}

.auth-label > span small {
  font-weight: 500;
  color: var(--text-light);
  margin-left: 4px;
}

.auth-label input {
  padding: 12px 14px;
  background: rgba(0,0,0,0.3);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  transition: all 0.15s;
}

.auth-label input:focus {
  outline: none;
  border-color: var(--gold);
  background: rgba(0,0,0,0.4);
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.15);
}

.auth-submit {
  margin-top: 6px;
  padding: 14px;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
  border: none;
  border-radius: 10px;
  color: #1a0f00;
  font-family: inherit;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  letter-spacing: 0.5px;
  box-shadow: 0 6px 20px rgba(251, 191, 36, 0.35);
  transition: all 0.15s;
}

.auth-submit:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(251, 191, 36, 0.5);
}

.auth-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.auth-error {
  margin-top: 4px;
  padding: 10px 12px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: 8px;
  color: #fca5a5;
  font-size: 13px;
  line-height: 1.5;
}

.auth-footer {
  margin-top: 20px;
  text-align: center;
  font-size: 13px;
  color: var(--text-light);
}

.auth-link {
  background: none;
  border: none;
  color: var(--gold);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  padding: 0 2px;
}

.auth-link:hover {
  color: var(--gold-light, #fde68a);
}

/* =============================================================================
   온보딩 화면
   ============================================================================= */
.onboard-screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: radial-gradient(ellipse at top, rgba(167, 139, 250, 0.12) 0%, transparent 55%),
              radial-gradient(ellipse at bottom, rgba(251, 191, 36, 0.08) 0%, transparent 55%),
              var(--bg);
}

.onboard-card {
  width: 100%;
  max-width: 460px;
  background: linear-gradient(145deg, var(--card-bg) 0%, var(--card-bg-2) 100%);
  border: 1.5px solid var(--gold-soft);
  border-radius: 18px;
  padding: 28px 22px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6),
              0 0 0 1px rgba(251, 191, 36, 0.15);
}

.onboard-welcome {
  text-align: center;
  padding-bottom: 20px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.onboard-logo {
  font-size: 44px;
  margin-bottom: 8px;
  filter: drop-shadow(0 0 12px rgba(251, 191, 36, 0.4));
}

.onboard-title {
  font-family: 'Nanum Myeongjo', serif;
  font-weight: 800;
  font-size: 22px;
  color: var(--gold);
  margin-bottom: 6px;
}

.onboard-email {
  font-size: 13px;
  color: var(--text-light);
  font-family: 'Cinzel', serif;
  letter-spacing: 0.5px;
}

.onboard-section {
  margin-bottom: 22px;
}

.onboard-section:last-child {
  margin-bottom: 0;
}

.onboard-section-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.onboard-section-title::before {
  content: '◆';
  color: var(--gold);
  font-size: 11px;
}

.onboard-section-desc {
  font-size: 12.5px;
  color: var(--text-light);
  line-height: 1.5;
  margin-bottom: 12px;
}

.onboard-create-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.onboard-create-form input {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  background: rgba(0,0,0,0.3);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
}

.onboard-create-form input:focus {
  outline: none;
  border-color: var(--gold);
  background: rgba(0,0,0,0.4);
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.15);
}

.btn-onboard-create {
  padding: 12px 16px;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
  border: none;
  border-radius: 10px;
  color: #1a0f00;
  font-family: inherit;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(251, 191, 36, 0.3);
}

.btn-onboard-create:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn-onboard-create:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.onboard-claim-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.onboard-claim-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  background: rgba(167, 139, 250, 0.08);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.onboard-claim-name {
  font-weight: 700;
  color: var(--text);
  font-size: 14px;
}

.btn-claim {
  padding: 8px 14px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border: none;
  border-radius: 8px;
  color: white;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 3px 10px rgba(167, 139, 250, 0.3);
}

.btn-claim:hover:not(:disabled) { transform: translateY(-1px); }
.btn-claim:disabled { opacity: 0.6; cursor: not-allowed; }

.onboard-footer {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 12.5px;
  color: var(--text-light);
}

/* =============================================================================
   학생 추가 버튼 (학급 화면)
   ============================================================================= */
.btn-add-student {
  margin-left: 8px;
  padding: 6px 12px;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
  border: none;
  border-radius: 8px;
  color: #1a0f00;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 3px 10px rgba(251, 191, 36, 0.3);
  letter-spacing: 0.3px;
}

.btn-add-student:hover { transform: translateY(-1px); }

.class-meta {
  margin-left: auto;
  font-size: 13px;
  color: var(--text-light);
  font-weight: normal;
}

.add-student-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* =============================================================================
   학생 추가 모달 - 탭/붙여넣기/파일업로드 강화
   ============================================================================= */
.modal.modal-wide {
  width: 100%;
  max-width: 460px;
}

/* 탭 헤더 */
.add-tabs {
  display: flex;
  gap: 4px;
  background: rgba(0,0,0,0.25);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 16px;
  border: 1px solid var(--border, var(--card-border-dim));
}

.add-tab {
  flex: 1;
  padding: 9px 6px;
  background: transparent;
  border: none;
  color: var(--text-light);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  letter-spacing: -0.02em;
}

.add-tab i { font-size: 12px; }

.add-tab.active {
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
  color: #1a0f00;
  box-shadow: 0 4px 12px rgba(251, 191, 36, 0.35);
}

.add-tab:hover:not(.active) {
  background: rgba(255,255,255,0.04);
  color: var(--text);
}

/* 탭 본문 */
.add-tab-body {
  min-height: 60px;
  margin-bottom: 14px;
}

.add-mode-desc {
  font-size: 12.5px;
  color: var(--text-light);
  line-height: 1.6;
  margin-bottom: 12px;
  padding: 10px 12px;
  background: rgba(167, 139, 250, 0.06);
  border-left: 3px solid var(--gold);
  border-radius: 4px;
}

.add-mode-desc strong {
  color: var(--gold);
  font-weight: 700;
}

/* 붙여넣기 textarea */
#paste-area {
  width: 100%;
  min-height: 140px;
  padding: 12px 14px;
  background: rgba(0,0,0,0.3);
  border: 1.5px solid var(--border, var(--card-border-dim));
  border-radius: 10px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.6;
  resize: vertical;
  letter-spacing: -0.01em;
}

#paste-area:focus {
  outline: none;
  border-color: var(--gold);
  background: rgba(0,0,0,0.4);
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.15);
}

/* 파일 드롭존 */
.file-drop {
  display: block;
  cursor: pointer;
  border: 2px dashed rgba(251, 191, 36, 0.35);
  border-radius: 12px;
  padding: 24px 16px;
  background: rgba(167, 139, 250, 0.04);
  transition: all 0.15s;
  text-align: center;
}

.file-drop:hover,
.file-drop.drag-over {
  border-color: var(--gold);
  background: rgba(251, 191, 36, 0.08);
  transform: translateY(-1px);
}

.file-drop-inner i {
  font-size: 32px;
  color: var(--gold);
  margin-bottom: 8px;
  display: block;
}

.file-drop-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 4px;
}

.file-drop-name {
  font-size: 12px;
  color: var(--text-light);
  letter-spacing: -0.01em;
}

/* 미리보기 영역 */
.preview-section {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border, var(--card-border-dim));
}

.preview-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 10px;
  letter-spacing: -0.02em;
}

.preview-title i { font-size: 12px; }

.preview-warn {
  margin-left: auto;
  font-size: 11.5px;
  color: #fca5a5;
  font-weight: 600;
}

.preview-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 180px;
  overflow-y: auto;
  padding: 8px;
  background: rgba(0,0,0,0.25);
  border-radius: 8px;
  border: 1px solid var(--border, var(--card-border-dim));
}

.preview-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px 4px 4px;
  background: rgba(167, 139, 250, 0.15);
  border: 1px solid rgba(167, 139, 250, 0.3);
  border-radius: 20px;
  font-size: 12.5px;
  color: var(--text);
  font-weight: 600;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.preview-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  background: var(--gold);
  color: #1a0f00;
  border-radius: 10px;
  font-size: 10.5px;
  font-weight: 800;
}

.preview-more {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  background: rgba(251, 191, 36, 0.12);
  border: 1px dashed var(--gold);
  border-radius: 20px;
  font-size: 12px;
  color: var(--gold);
  font-weight: 700;
}

.btn-confirm:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.3);
}

/* 좁은 화면 대응 */
@media (max-width: 380px) {
  .add-tab { font-size: 11.5px; padding: 8px 4px; }
  .add-tab i { display: none; } /* 좁으면 아이콘 숨김 */
}

/* =============================================================================
   학생 아바타 - 사진 (avatar_image) 지원
   ========================================================================== */
.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: inherit;   /* 부모 .avatar의 원형(또는 라운드) 그대로 따라감 */
  user-select: none;
  -webkit-user-drag: none;
}
.avatar.avatar-photo {
  /* 사진이 있을 때는 배경 그라데이션 제거. img가 꽉 채움 */
  background: transparent !important;
  overflow: hidden;
  padding: 0;
}
.avatar.avatar-photo > * { line-height: 0; }
.log-avatar.avatar-photo {
  background: transparent !important;
  overflow: hidden;
  padding: 0;
}

/* =============================================================================
   학생 상세 - 우측 상단 '학생 삭제' 버튼
   ========================================================================== */
.detail-hero { position: relative; }
.detail-hero-delete {
  position: absolute;
  top: 10px;
  right: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px 7px 10px;
  border-radius: 10px;
  border: 1px solid rgba(248, 113, 113, 0.45);
  background: linear-gradient(180deg, rgba(127,29,29,0.45), rgba(127,29,29,0.25));
  color: #fecaca;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  z-index: 3;
}
.detail-hero-delete i {
  font-size: 12px;
}
.detail-hero-delete:hover {
  background: linear-gradient(180deg, rgba(220,38,38,0.55), rgba(127,29,29,0.4));
  border-color: rgba(248,113,113,0.7);
  color: #fff;
  transform: translateY(-1px);
}
.detail-hero-delete:active { transform: translateY(0); }
@media (max-width: 420px) {
  .detail-hero-delete span { display: none; }   /* 좁으면 휴지통 아이콘만 */
  .detail-hero-delete { padding: 8px 10px; }
}

/* =============================================================================
   아바타 모달 - 사진 업로드 드롭존
   ========================================================================== */
.avatar-photo-drop {
  display: block;
  border: 2px dashed rgba(192, 132, 252, 0.45);
  border-radius: 14px;
  background: rgba(139, 92, 246, 0.06);
  padding: 22px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.18s ease;
  color: #ddd6fe;
}
.avatar-photo-drop:hover,
.avatar-photo-drop.drag-over {
  background: rgba(139, 92, 246, 0.14);
  border-color: rgba(192, 132, 252, 0.75);
}
.avatar-photo-drop-inner i {
  font-size: 28px;
  display: block;
  margin-bottom: 8px;
  opacity: 0.9;
}
.avatar-photo-drop-inner .file-drop-label {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 4px;
}
.avatar-photo-drop-inner .file-drop-name {
  font-size: 12px;
  color: rgba(221, 214, 254, 0.7);
}

/* =============================================================================
   이모지 피커 모달
   ========================================================================== */
.emoji-picker-current {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 12px;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
}
.emoji-picker-current-em {
  font-size: 30px;
  line-height: 1;
}
.emoji-picker-scroll {
  max-height: 50vh;
  overflow-y: auto;
  padding-right: 4px;
  margin-bottom: 12px;
}
.emoji-picker-scroll .picker-section + .picker-section { margin-top: 14px; }
.emoji-picker-scroll::-webkit-scrollbar { width: 8px; }
.emoji-picker-scroll::-webkit-scrollbar-track { background: transparent; }
.emoji-picker-scroll::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.12);
  border-radius: 4px;
}

/* 활동 편집의 이모지 버튼 - 클릭 가능 표시 */
.activity-edit-item .f-emoji.emoji-edit-btn {
  font-size: 22px;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.activity-edit-item .f-emoji.emoji-edit-btn:hover {
  background: rgba(192, 132, 252, 0.18);
  border-color: rgba(192, 132, 252, 0.5);
  transform: scale(1.05);
}
.activity-edit-item .f-emoji.emoji-edit-btn:active {
  transform: scale(0.96);
}
