/* ═══════════════════════════════════════════════════════════
   수학문제 뷰어 – 듀오링고 스타일
   ═══════════════════════════════════════════════════════════ */

/* ══ 토스트 알림 ══ */
.app-toast {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
  z-index: 99999; padding: 10px 22px; border-radius: 12px;
  font-size: 0.88rem; font-weight: 600; color: #fff;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  animation: toastIn 0.25s ease;
  max-width: 85%; text-align: center;
}
.app-toast-info { background: #3b82f6; }
.app-toast-success { background: #22c55e; }
.app-toast-warning { background: #f59e0b; color: #1f2937; }
.app-toast-error { background: #ef4444; }
.app-toast-clue {
  background: linear-gradient(135deg, #1e1b2e 0%, #2d2640 100%);
  color: #e8dcc8;
  border: 1px solid rgba(196, 167, 125, 0.5);
  box-shadow: 0 4px 20px rgba(0,0,0,0.4), 0 0 20px rgba(196, 167, 125, 0.12);
  text-shadow: 0 0 8px rgba(196, 167, 125, 0.15);
  white-space: nowrap;
}
.app-toast-hide { opacity: 0; transition: opacity 0.3s; }
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(10px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

:root {
  --bg:         #131f24;
  --surface:    #1b2b33;
  --surface2:   #233a44;
  --border:     #2d4a56;
  --text:       #e5e5e5;
  --text-dim:   #89a8b5;
  --duo-green:  #58CC02;
  --duo-green2: #46a302;
  --accent:     #1cb0f6;
  --accent2:    #1899d6;
  --gold:       #ff9600;
  --green:      #58CC02;
  --green-bg:   #0d3b00;
  --red:        #ff4b4b;
  --red-bg:     #3b0d0d;
  --radius:     16px;
  --radius-sm:  12px;
  --shadow:     0 4px 16px rgba(0,0,0,0.3);
  --shadow-sm:  0 2px 8px rgba(0,0,0,0.2);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* ═══ 스플래시 화면 ═══ */
.splash-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}
.splash-overlay.splash-hide {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.splash-video {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}
.splash-skip {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 10;
  background: rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.8);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 16px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.2);
  cursor: pointer;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: background 0.2s, color 0.2s;
  opacity: 0;
  pointer-events: none;
}
.splash-skip.splash-skip-ready {
  pointer-events: auto;
  animation: splashSkipFadeIn 0.5s ease 0s forwards;
}
.splash-skip:hover {
  background: rgba(255,255,255,0.3);
  color: #fff;
}
.splash-loading-bottom {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
}
@keyframes splashSkipFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.splash-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.splash-mascot {
  width: 160px;
  height: 160px;
  object-fit: contain;
  animation: splashBounce 1.2s ease-in-out infinite;
  filter: drop-shadow(0 12px 32px rgba(88,204,2,0.3));
}
.splash-logo {
  width: 260px;
  max-width: 70vw;
  object-fit: contain;
  animation: splashFadeUp 0.8s ease 0.3s both;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.4));
}
.splash-loading {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  animation: splashFadeUp 0.8s ease 0.6s both;
}
.splash-loading-bar {
  width: 180px;
  height: 6px;
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
  overflow: hidden;
}
.splash-loading-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #58CC02, #1cb0f6);
  border-radius: 3px;
  animation: splashLoad 2.5s ease-in-out forwards;
}
.splash-loading-text {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.4);
  font-weight: 500;
  letter-spacing: 1px;
}

@keyframes splashBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-14px); }
}
@keyframes splashFadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes splashLoad {
  0%   { width: 0%; }
  60%  { width: 70%; }
  100% { width: 100%; }
}

@media (max-width: 600px) {
  .splash-mascot { width: 120px; height: 120px; }
  .splash-logo { width: 200px; }
  .splash-loading-bar { width: 140px; }
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans KR', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

/* ═══════════════════════════════════════════════════════════
   헤더
   ═══════════════════════════════════════════════════════════ */
.header {
  background: var(--surface);
  border-bottom: 2px solid var(--duo-green);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.header h1 {
  font-size: 1.2rem;
  color: var(--duo-green);
  font-weight: 800;
  letter-spacing: -0.3px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header .badge {
  font-size: 0.7rem;
  color: var(--text-dim);
  background: var(--bg);
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 600;
}

/* 점검 모드 오버레이 */
.maintenance-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}
.maintenance-content {
  text-align: center;
  padding: 32px;
  max-width: 360px;
}
.maintenance-icon {
  font-size: 4rem;
  margin-bottom: 16px;
  opacity: 0.9;
}
.maintenance-content h2 {
  font-size: 1.5rem;
  color: #fbbf24;
  margin-bottom: 12px;
}
.maintenance-content p {
  font-size: 1rem;
  color: #94a3b8;
  line-height: 1.5;
}

/* 공지 배너 */
.notice-banner {
  padding: 10px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  line-height: 1.4;
  display: none;
  position: relative;
}
.notice-banner.notice-info { background: rgba(59,130,246,0.15); color: #60a5fa; border-bottom: 1px solid rgba(59,130,246,0.3); }
.notice-banner.notice-event { background: rgba(16,185,129,0.15); color: #34d399; border-bottom: 1px solid rgba(16,185,129,0.3); }
.notice-banner.notice-warn { background: rgba(245,158,11,0.15); color: #fbbf24; border-bottom: 1px solid rgba(245,158,11,0.3); }
.notice-banner.notice-urgent { background: rgba(239,68,68,0.15); color: #f87171; border-bottom: 1px solid rgba(239,68,68,0.3); }
.notice-close {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: inherit;
  font-size: 1rem;
  cursor: pointer;
  opacity: 0.6;
  padding: 4px;
}
.notice-close:hover { opacity: 1; }

.settings-btn {
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  transition: background 0.2s;
  line-height: 1;
}
.settings-btn:hover {
  background: var(--surface2);
}

/* ═══════════════════════════════════════════════════════════
   콘텐츠
   ═══════════════════════════════════════════════════════════ */
.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 16px;
  overflow-x: hidden;
  width: 100%;
}
body.has-bottom-tabbar .container {
  padding-bottom: 88px;
}

/* 하단 탭바 */
.bottom-tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 720px;
  margin: 0 auto;
  height: 64px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 100;
}
.bottom-tab-bar .tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.75rem;
  font-weight: 600;
  transition: color 0.2s;
  min-width: 0;
}
.bottom-tab-bar .tab-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.bottom-tab-bar .tab-item:hover {
  color: var(--text);
}
.bottom-tab-bar .tab-item.active {
  color: var(--accent);
}
.bottom-tab-bar .tab-icon {
  font-size: 1.4rem;
  position: relative;
}
.tab-badge {
  position: absolute;
  top: -4px;
  right: -10px;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  background: #ef4444;
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  box-shadow: 0 1px 4px rgba(239,68,68,0.4);
  animation: badgePulse 2s ease-in-out infinite;
}
.tab-badge:empty {
  min-width: 10px;
  height: 10px;
  padding: 0;
}
@keyframes badgePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}
@media (max-width: 380px) {
  .bottom-tab-bar .tab-item { font-size: 0.68rem; padding: 6px 4px; }
}

/* ═══════════════════════════════════════════════════════════
   모달 (이름 입력 / 설정)
   ═══════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 20px;
  animation: fadeIn 0.25s ease;
}

/* 학부모 PIN / 대시보드 모달은 설정 모달 위에 표시 */
#pinModal,
#parentModal {
  z-index: 1000;
  overflow-x: hidden;
  overflow-y: auto;
}

#parentModal .parent-dashboard {
  max-width: 100%;
}

/* AI 종합 분석 전용 팝업 (집중 보기) */
#aiAnalysisModal {
  z-index: 1001;
  align-items: flex-start;
  padding: 16px;
  overflow-y: auto;
}

.ai-analysis-modal-card {
  width: 94%;
  max-width: 749px;
  max-height: 96vh;
  margin: auto;
  position: relative;
  text-align: left;
  overflow: hidden;
  background: var(--bg) !important;
  padding: 0;
}

/* 닫기 버튼 – 카드 우상단 고정 */
.ai-analysis-modal-card > .ai-analysis-modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
}

/* 전체 스크롤 영역 (헤더 + 본문 함께 스크롤) */
.ai-analysis-modal-scroll {
  overflow-y: auto;
  overflow-x: hidden;
  max-height: 96vh;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}

.ai-analysis-logo-img {
  max-width: 700px;
  width: 90%;
  height: auto;
  display: block;
  object-fit: contain;
  margin: 0 auto;
  transform: scale(1.3);
  transform-origin: center center;
}

.ai-analysis-modal-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 20px 10px;
  gap: 4px;
}

.ai-analysis-modal-header .modal-title {
  margin: 0;
  font-size: 1.25rem;
  color: #fff;
}

.ai-analysis-modal-close {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
}

.ai-analysis-modal-close:hover {
  background: rgba(255,255,255,0.2);
  color: var(--text);
}

.ai-analysis-modal-body {
  padding: 16px 3% 100px;
  overflow-x: hidden;
  min-height: 200px;
  background: transparent;
}


.modal-card {
  background: var(--surface);
  border: 2px solid var(--duo-green);
  border-radius: 20px;
  padding: 36px 28px;
  max-width: 360px;
  width: 100%;
  text-align: center;
  box-shadow: 0 8px 40px rgba(0,0,0,0.4);
  animation: slideUp 0.3s ease;
}

.modal-mascot {
  font-size: 3.5rem;
  margin-bottom: 12px;
  animation: bounce 0.6s ease;
}

.modal-mascot-img {
  width: 110px;
  height: 110px;
  object-fit: cover;
  object-position: 35% center;
  border-radius: 50%;
  margin-bottom: 12px;
  animation: bounce 0.6s ease;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
}

.modal-mascot-img.settings-mascot {
  width: 80px;
  height: 80px;
}

.modal-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--duo-green);
  margin-bottom: 6px;
}

.modal-sub {
  font-size: 0.95rem;
  color: var(--text-dim);
  margin-bottom: 20px;
}

/* ═══ 구독 플랜 모달 (리디자인) ═══ */
.subscription-plan-card {
  max-width: 460px;
  text-align: center;
  padding: 0 !important;
  overflow: hidden;
}

/* ── 헤더 ── */
.plan-header {
  background: linear-gradient(135deg, #1b2b33 0%, #1a3a4a 50%, #1b2b33 100%);
  padding: 28px 24px 22px;
  border-bottom: 1px solid rgba(88, 204, 2, 0.15);
}
.plan-header-icon {
  display: block;
  font-size: 2.4rem;
  margin-bottom: 6px;
  filter: drop-shadow(0 2px 8px rgba(255, 150, 0, 0.4));
}
.plan-header-title {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text);
  margin: 0 0 4px;
}
.plan-header-sub {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin: 0;
}

/* ── 티어 카드 3장 ── */
.plan-tier-cards {
  display: flex;
  gap: 10px;
  padding: 20px 18px 6px;
  justify-content: center;
}
.plan-tier {
  flex: 1;
  max-width: 140px;
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 16px 8px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  position: relative;
  transition: transform 0.2s, box-shadow 0.2s;
}
.plan-tier:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.plan-tier-badge {
  font-size: 1.6rem;
  line-height: 1;
}
.plan-tier-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.5px;
}
.plan-tier-price {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--duo-green);
}
.plan-tier-unit {
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--text-dim);
}
.plan-tier-desc {
  font-size: 0.7rem;
  color: var(--text-dim);
  line-height: 1.35;
  margin-top: 2px;
}
.plan-tier-price-yearly {
  font-size: 0.75rem;
  font-weight: 700;
  margin-top: 5px;
}
.plan-tier-price-yearly .plan-tier-unit {
  font-size: 0.62rem;
  font-weight: 500;
  color: var(--text-dim);
}
.plan-tier-premium .plan-tier-price-yearly { color: var(--duo-green); }
.plan-tier-max .plan-tier-price-yearly { color: var(--gold); }
.plan-tier-badge-off {
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 700;
  background: rgba(255, 150, 0, 0.25);
  color: var(--gold);
  padding: 2px 6px;
  border-radius: 6px;
  margin-left: 6px;
  vertical-align: middle;
}
.plan-tier-btns {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}
.plan-tier-btns .plan-tier-btn {
  flex: 1;
  margin-top: 0;
  padding: 8px 6px;
  font-size: 0.76rem;
}
.plan-tier-cta {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.plan-tier-btn {
  margin-top: 10px;
  padding: 8px 14px;
  width: 100%;
  max-width: 100%;
  font-size: 0.8rem;
  font-weight: 700;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.plan-tier-btn:active {
  transform: scale(0.98);
}
.plan-tier-btn-premium {
  background: linear-gradient(135deg, #58CC02, #46a302);
  color: #fff;
  box-shadow: 0 2px 10px rgba(88, 204, 2, 0.3);
}
.plan-tier-btn-premium:hover {
  box-shadow: 0 4px 14px rgba(88, 204, 2, 0.4);
}
.plan-tier-btn-max {
  background: linear-gradient(135deg, #ff9600, #e68600);
  color: #fff;
  box-shadow: 0 2px 10px rgba(255, 150, 0, 0.3);
}
.plan-tier-btn-max:hover {
  box-shadow: 0 4px 14px rgba(255, 150, 0, 0.4);
}

/* 베이직 */
.plan-tier-basic {
  border-color: rgba(137, 168, 181, 0.3);
}
.plan-tier-basic .plan-tier-price {
  color: var(--text-dim);
}

/* 프리미엄 (인기) */
.plan-tier-premium {
  border-color: rgba(88, 204, 2, 0.5);
  background: linear-gradient(180deg, rgba(88, 204, 2, 0.08) 0%, var(--surface2) 100%);
  box-shadow: 0 0 20px rgba(88, 204, 2, 0.1);
}
.plan-tier-pop-tag {
  position: absolute;
  top: -9px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #58CC02, #46a302);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 8px;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

/* 맥스 */
.plan-tier-max {
  border-color: rgba(255, 150, 0, 0.4);
  background: linear-gradient(180deg, rgba(255, 150, 0, 0.06) 0%, var(--surface2) 100%);
}
.plan-tier-max .plan-tier-price {
  color: var(--gold);
}

/* ── 기능 비교 ── */
.plan-compare-wrap {
  padding: 14px 18px 0;
}
.plan-compare-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
  text-align: left;
}
.subscription-plan-table-wrap {
  overflow-x: auto;
  margin-bottom: 12px;
  -webkit-overflow-scrolling: touch;
  border-radius: 10px;
  border: 1px solid var(--border);
}
.subscription-plan-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.subscription-plan-table th,
.subscription-plan-table td {
  padding: 9px 8px;
  vertical-align: middle;
}
.subscription-plan-table thead th {
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border-bottom: 1.5px solid var(--border);
}
.plan-col-feature {
  text-align: left;
  min-width: 110px;
  color: var(--text);
}
.plan-col-tier {
  text-align: center;
  min-width: 62px;
}
.plan-th-basic { color: var(--text-dim); background: rgba(137, 168, 181, 0.06); }
.plan-th-premium { color: var(--duo-green); background: rgba(88, 204, 2, 0.08); }
.plan-th-max { color: var(--gold); background: rgba(255, 150, 0, 0.08); }
.plan-td-basic { background: rgba(137, 168, 181, 0.03); }
.plan-td-premium { background: rgba(88, 204, 2, 0.04); }
.plan-td-max { background: rgba(255, 150, 0, 0.04); }
.plan-row-even td { background-blend-mode: multiply; }
.plan-row-even .plan-td-basic { background: rgba(137, 168, 181, 0.06); }
.plan-row-even .plan-td-premium { background: rgba(88, 204, 2, 0.07); }
.plan-row-even .plan-td-max { background: rgba(255, 150, 0, 0.07); }
.plan-row-even .plan-col-feature { background: rgba(255,255,255,0.02); }

.subscription-plan-table tbody tr {
  border-bottom: 1px solid rgba(45, 74, 86, 0.4);
}
.subscription-plan-table tbody tr:last-child {
  border-bottom: none;
}

.subscription-plan-table .plan-check {
  color: var(--duo-green);
  font-weight: 700;
  font-size: 1rem;
  text-shadow: 0 0 6px rgba(88, 204, 2, 0.3);
}
.subscription-plan-table .plan-x {
  color: #ff6b6b;
  font-size: 0.8rem;
  opacity: 0.6;
}
.subscription-plan-table .plan-triangle {
  color: #eab308;
  font-size: 1rem;
  font-weight: 700;
  opacity: 0.95;
}
.subscription-plan-table .plan-text {
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 500;
}
.subscription-plan-note {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin: 0 18px 14px;
  text-align: center;
  opacity: 0.7;
}
#subscriptionPlanModal .modal-btn-secondary {
  margin: 0 18px 20px;
  width: calc(100% - 36px);
  border-radius: 12px;
}

/* ── 모바일 대응 ── */
@media (max-width: 600px) {
  #subscriptionPlanModal.modal-overlay {
    align-items: flex-start;
    padding: 10px 8px 24px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .subscription-plan-card {
    max-width: 100%;
    width: 100%;
    max-height: none;
  }
  .plan-header {
    padding: 22px 16px 18px;
  }
  .plan-header-icon { font-size: 2rem; }
  .plan-header-title { font-size: 1.15rem; }
  .plan-tier-cards {
    padding: 14px 12px 4px;
    gap: 8px;
  }
  .plan-tier {
    padding: 14px 6px 12px;
    border-radius: 12px;
  }
  .plan-tier-badge { font-size: 1.3rem; }
  .plan-tier-name { font-size: 0.75rem; }
  .plan-tier-price { font-size: 1rem; }
  .plan-tier-price-yearly { font-size: 0.7rem; }
  .plan-tier-badge-off { font-size: 0.55rem; padding: 1px 5px; }
  .plan-tier-btns .plan-tier-btn { font-size: 0.7rem; padding: 6px 4px; }
  .plan-tier-desc { font-size: 0.65rem; }
  .plan-compare-wrap { padding: 12px 12px 0; }
  .plan-compare-title { font-size: 0.8rem; }
  .subscription-plan-table { font-size: 0.76rem; }
  .subscription-plan-table th,
  .subscription-plan-table td { padding: 7px 5px; }
  .plan-col-feature { min-width: 0; font-size: 0.72rem; }
  .plan-col-tier { min-width: 0; font-size: 0.72rem; }
  .subscription-plan-note { margin: 0 12px 12px; }
  #subscriptionPlanModal .modal-btn-secondary { margin: 0 12px 16px; width: calc(100% - 24px); }
}
@media (max-width: 380px) {
  .plan-tier-cards { gap: 6px; }
  .plan-tier { padding: 12px 4px 10px; }
  .plan-tier-badge { font-size: 1.1rem; }
  .plan-tier-price { font-size: 0.9rem; }
  .plan-tier-price-yearly { font-size: 0.65rem; }
  .plan-tier-btns .plan-tier-btn { font-size: 0.65rem; }
  .plan-col-feature { font-size: 0.68rem; }
  .plan-col-tier { font-size: 0.66rem; }
}

.mailbox-modal-card {
  max-width: 420px;
  text-align: left;
}
.mailbox-auto-delete-hint {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin: -8px 0 12px;
  opacity: 0.85;
}
.mailbox-unread-hint {
  font-size: 0.9rem;
  color: var(--duo-green);
  margin-bottom: 12px;
  padding: 8px 12px;
  background: rgba(58, 191, 140, 0.15);
  border-radius: 8px;
}
.mailbox-list {
  max-height: 280px;
  overflow-y: auto;
  margin-bottom: 16px;
}
.mailbox-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: background 0.2s;
}
.mailbox-item:hover {
  background: var(--surface3);
}
.mailbox-item.mailbox-unread {
  border-left: 4px solid var(--duo-green);
  font-weight: 600;
}
.mailbox-item.mailbox-read .mailbox-item-subject,
.mailbox-item.mailbox-read .mailbox-item-date {
  color: #94a3b8;
  font-weight: 400;
}
.mailbox-item-subject {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mailbox-item-date {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-left: 8px;
  flex-shrink: 0;
}
.mailbox-detail {
  margin-bottom: 16px;
}
.mailbox-detail-subject {
  font-size: 1.1rem;
  margin-bottom: 12px;
  color: var(--text);
}
.mailbox-detail-body {
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-dim);
  font-size: 0.95rem;
  margin-bottom: 12px;
  line-height: 1.5;
}
.mailbox-detail-link {
  display: inline-block;
  padding: 10px 16px;
  background: var(--duo-green);
  color: var(--bg);
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 12px;
}
.mailbox-detail-link:hover {
  opacity: 0.9;
}

.modal-input {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 1.1rem;
  outline: none;
  text-align: center;
  transition: border-color 0.2s;
  margin-bottom: 16px;
}
.modal-input:focus { border-color: var(--duo-green); }
.modal-input.shake { animation: shake 0.4s ease; }

/* 모달 내 드롭다운 */
.modal-select {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 1.05rem;
  outline: none;
  text-align: center;
  margin-bottom: 16px;
  cursor: pointer;
  transition: border-color 0.2s;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg fill='%2389a8b5' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 24px;
}
.modal-select:focus { border-color: var(--duo-green); }

.modal-btn {
  width: 100%;
  padding: 14px;
  background: var(--duo-green);
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.modal-btn:hover { background: var(--duo-green2); }
.modal-btn:active { transform: scale(0.98); }

.modal-btn-secondary {
  width: 100%;
  padding: 12px;
  background: transparent;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s;
}
.modal-btn-secondary:hover { border-color: var(--text-dim); }

.modal-btn-danger {
  width: 100%;
  padding: 10px;
  background: transparent;
  border: 2px solid var(--danger);
  border-radius: var(--radius-sm);
  color: var(--danger);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.modal-btn-danger:hover {
  background: var(--danger);
  color: #fff;
}

/* 앱 스타일 확인 모달 (프로필 삭제 등) */
.app-confirm-overlay {
  z-index: 10000;
  background: rgba(15, 23, 42, 0.85);
}
.app-confirm-card {
  animation: slideUp 0.25s ease;
}
.app-confirm-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.app-confirm-buttons .modal-btn,
.app-confirm-buttons .modal-btn-secondary,
.app-confirm-buttons .modal-btn-danger {
  flex: 1;
  min-width: 100px;
}

/* 프로필 전환 모달 */
.profile-current-wrap { margin-bottom: 8px; }
.profile-switch-btn { margin-bottom: 14px; }
.profile-list { margin: 12px 0; max-height: 240px; overflow-y: auto; }
.profile-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  margin-bottom: 6px;
  background: var(--surface2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.profile-item.current { border-color: var(--duo-green); background: rgba(88, 204, 2, 0.08); }
.profile-name { font-weight: 500; }
.profile-badge { font-size: 0.75rem; color: var(--duo-green); margin-left: 6px; }
.profile-max-hint {
  text-align: center;
  padding: 14px 12px;
  margin: 12px 0 4px;
  background: rgba(167, 139, 250, 0.12);
  border: 1px solid rgba(167, 139, 250, 0.3);
  border-radius: 10px;
  color: #c4b5fd;
  font-size: 0.88rem;
  line-height: 1.5;
}
.profile-actions { display: flex; gap: 8px; }
.modal-btn-small {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.modal-btn-small:hover { border-color: var(--duo-green); color: var(--duo-green); }
.modal-btn-small.danger { border-color: var(--red); color: var(--red); }
.modal-btn-small.danger:hover { background: var(--red); color: #fff; }
.profile-actions .modal-btn-small { flex-shrink: 0; }
.profile-add-wrap { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }

/* ═══════════════════════════════════════════════════════════
   히어로 섹션
   ═══════════════════════════════════════════════════════════ */
.hero {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  animation: fadeIn 0.4s ease;
}

.hero-mascot {
  font-size: 3rem;
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border-radius: 50%;
  animation: float 3s ease-in-out infinite;
}

.hero-mascot-img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  object-position: 35% center;
  flex-shrink: 0;
  border-radius: 50%;
  animation: float 3s ease-in-out infinite;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.3));
}

.hero-text { flex: 1; }

.hero-greeting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.hero-right-btns {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.hero-mailbox-btn {
  position: relative;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 1.1rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}
.hero-mailbox-btn:hover {
  background: var(--surface3);
  transform: scale(1.05);
}
.hero-mailbox-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  background: #ef4444;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hero-edit-btn {
  flex-shrink: 0;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 1.1rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}
.hero-edit-btn:hover {
  background: var(--surface3);
  transform: scale(1.05);
}

.hero-greeting {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 2px;
}

.hero-sub {
  font-size: 0.9rem;
  color: var(--text-dim);
}

/* ═══════════════════════════════════════════════════════════
   대시보드 (streak, today, total)
   ═══════════════════════════════════════════════════════════ */
.dashboard {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 24px;
  animation: fadeIn 0.5s ease;
}

.dash-item {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 8px;
  text-align: center;
  transition: transform 0.15s, border-color 0.2s;
  cursor: default;
}
.dash-item:hover {
  transform: translateY(-2px);
  border-color: var(--duo-green);
}

.dash-icon {
  font-size: 1.5rem;
  margin-bottom: 4px;
}

.dash-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--duo-green);
  line-height: 1.2;
}

.dash-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

/* ═══════════════════════════════════════════════════════════
   섹션 타이틀
   ═══════════════════════════════════════════════════════════ */
.section-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 14px;
  padding-left: 2px;
}

/* ═══════════════════════════════════════════════════════════
   코스 카드 (그라데이션)
   ═══════════════════════════════════════════════════════════ */
.course-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.course-card {
  border: 2px solid transparent;
  border-radius: var(--radius);
  padding: 20px 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.course-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.05) 0%, transparent 60%);
  pointer-events: none;
}

.course-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
}

.course-card:active {
  transform: translateY(-1px);
}

.course-icon-wrap {
  width: 56px;
  height: 56px;
  background: rgba(255,255,255,0.15);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  backdrop-filter: blur(4px);
}

.course-icon {
  font-size: 1.8rem;
  line-height: 1;
}

.course-info {
  flex: 1;
  min-width: 0;
  z-index: 1;
}

.course-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 3px;
  color: #fff;
}

.course-meta {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.7);
  font-weight: 500;
}

.course-arrow {
  font-size: 1.8rem;
  color: rgba(255,255,255,0.5);
  flex-shrink: 0;
  font-weight: 700;
  z-index: 1;
}

/* ── 추천 배지 & 학년 태그 ── */
.recommend-badge {
  display: inline-block;
  background: var(--gold);
  color: #1a1a2e;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  margin-right: 6px;
  vertical-align: middle;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.grade-tag {
  display: inline-block;
  background: rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.85);
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  margin-right: 6px;
  vertical-align: middle;
}

.course-card.recommended {
  box-shadow: 0 0 0 2px var(--gold), var(--shadow-sm);
}

/* ═══════════════════════════════════════════════════════════
   듀오링고 Path View (유닛 경로)
   ═══════════════════════════════════════════════════════════ */
.unit-path {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  padding: 10px 0 20px;
}

.unit-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 8px 16px 14px;
  position: relative;
  transition: transform 0.2s ease;
  animation: fadeIn 0.4s ease both;
}

/* ── 연결선 ── */
.unit-connector {
  width: 3px;
  height: 28px;
  border-left: 3px dashed var(--border);
  position: absolute;
  top: -28px;
  left: 50%;
  transform: translateX(-50%);
}
.connector-done {
  border-left-color: var(--duo-green);
  border-left-style: solid;
}

/* ── 원형 노드 ── */
.unit-circle {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  flex-shrink: 0;
  transition: all 0.25s;
  position: relative;
}

.unit-icon {
  line-height: 1;
}

/* ── Completed 상태 ── */
.unit-completed {
  cursor: pointer;
}
.unit-completed:hover { transform: scale(1.06); }
.unit-completed:active { transform: scale(0.97); }

.unit-completed .unit-circle {
  background: var(--duo-green);
  border: 4px solid var(--duo-green2);
  color: #fff;
  font-size: 2rem;
  font-weight: 800;
  box-shadow: 0 4px 16px rgba(88, 204, 2, 0.3);
}

.unit-completed .unit-title { color: var(--duo-green); }

/* ── Active 상태 ── */
.unit-active {
  cursor: pointer;
}
.unit-active:hover { transform: scale(1.08); }
.unit-active:active { transform: scale(0.97); }

.unit-active .unit-circle {
  width: 96px;
  height: 96px;
  background: var(--surface);
  border: 4px solid var(--duo-green);
  color: var(--duo-green);
  font-size: 2.4rem;
  box-shadow: 0 0 0 8px rgba(88, 204, 2, 0.12), 0 6px 24px rgba(88, 204, 2, 0.2);
  animation: pathPulse 2s ease-in-out infinite;
}

.unit-active .unit-title {
  font-size: 1.05rem;
  color: var(--text);
}

.unit-active .unit-meta {
  color: var(--duo-green);
  font-weight: 600;
}

/* ── Locked 상태 ── */
.unit-locked {
  cursor: not-allowed;
  opacity: 0.5;
}

.unit-locked .unit-circle {
  background: var(--surface2);
  border: 4px solid var(--border);
  color: var(--text-dim);
  font-size: 1.6rem;
}

.unit-locked .unit-title { color: var(--text-dim); }
.unit-locked .unit-meta { color: var(--text-dim); }

/* ── 라벨 ── */
.unit-label {
  text-align: center;
}

.unit-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}

.unit-meta {
  font-size: 0.78rem;
  color: var(--sub);
  font-weight: 500;
}
.unit-meta-pct {
  font-size: 0.7rem;
  color: var(--duo-green);
  font-weight: 600;
}

/* ── 잠금 토스트 ── */
.locked-toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  z-index: 9999;
  animation: toastIn 0.3s ease, toastIn 0.3s ease 1.8s reverse forwards;
}

/* ── 다른 학년 접이식 ── */
.other-grades-section {
  margin-top: 16px;
}

.section-toggle {
  cursor: pointer;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
}
.section-toggle::before {
  content: '▸';
  transition: transform 0.2s;
}
details[open] > .section-toggle::before {
  transform: rotate(90deg);
}
.section-toggle::-webkit-details-marker { display: none; }

.unit-path-other .unit-node { opacity: 0.7; }
.unit-path-other .unit-node:hover { opacity: 1; }

/* ── 학년 업 알림 배너 ── */
.grade-up-banner {
  background: linear-gradient(135deg, #064e3b, #059669);
  border: 2px solid #10b981;
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin-bottom: 18px;
  text-align: center;
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  animation: slideUp 0.4s ease, celebratePulse 1s ease 0.4s;
}

/* ═══════════════════════════════════════════════════════════
   오늘의 미션 카드 (홈 화면)
   ═══════════════════════════════════════════════════════════ */
.mission-card {
  background: var(--surface2);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  animation: fadeIn 0.4s ease;
}
.mission-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 10px 0;
}
.mission-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mission-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--surface);
  border-radius: 10px;
  font-size: 0.9rem;
}
.mission-item.mission-done {
  opacity: 0.85;
  background: var(--green-bg);
}
.mission-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}
.mission-text {
  flex: 1;
  color: var(--text);
}
.mission-reward {
  font-size: 0.8rem;
  color: var(--gold);
  font-weight: 700;
}
.mission-total-reward {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 0.85rem;
  color: var(--gold);
  font-weight: 700;
  text-align: center;
}

/* ── 오늘의 미션 완료 팝업 ── */
.mission-complete-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.75);
  animation: missionOverlayFadeIn 0.4s ease;
}
@keyframes missionOverlayFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.mission-complete-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 28px 36px;
  margin: 16px;
  max-width: min(420px, calc(100vw - 32px));
  min-width: 280px;
  background: linear-gradient(135deg, var(--surface2) 0%, var(--surface) 100%);
  border: 2px solid var(--duo-green);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(88, 204, 2, 0.3);
  animation: missionStagePop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes missionStagePop {
  0% { transform: scale(0.5); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
.mission-complete-badge {
  font-size: 4rem;
  filter: drop-shadow(0 0 16px rgba(255, 200, 0, 0.6));
}
.mission-complete-badge.mission-complete-badge-anim {
  animation: missionBadgeBounce 0.6s ease;
}
@keyframes missionBadgeBounce {
  0%, 100% { transform: scale(1); }
  30% { transform: scale(1.2); }
  60% { transform: scale(0.95); }
}
.mission-complete-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
  opacity: 0;
  text-align: center;
  word-wrap: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
}
.mission-complete-title.mission-complete-title-anim {
  animation: missionTextFade 0.4s ease forwards;
}
.mission-complete-sub {
  font-size: 1rem;
  color: var(--text-dim);
  opacity: 0;
  text-align: center;
}
.mission-complete-sub.mission-complete-sub-anim {
  animation: missionTextFade 0.4s ease forwards;
}
.mission-complete-rewards {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  text-align: center;
  opacity: 0;
}
.mission-complete-rewards.mission-complete-stars-anim {
  animation: missionStarsPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
.mission-complete-stars {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--gold);
  white-space: nowrap;
}
.mission-complete-xp {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent, #22c55e);
  white-space: nowrap;
}
@keyframes missionStarsPop {
  0% { opacity: 0; transform: scale(0.5); }
  100% { opacity: 1; transform: scale(1.2); }
}
@keyframes missionTextFade {
  to { opacity: 1; }
}
.mission-complete-btn {
  margin-top: 8px;
}
.mission-complete-sparkles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.mission-sparkle {
  position: absolute;
  font-size: 1.5rem;
  opacity: 0;
  animation: missionSparkle1 2s ease forwards;
  top: 50%;
  left: 50%;
}
.mission-sparkle:nth-child(1) { animation-name: missionSparkle1; }
.mission-sparkle:nth-child(2) { animation-name: missionSparkle2; }
.mission-sparkle:nth-child(3) { animation-name: missionSparkle3; }
.mission-sparkle:nth-child(4) { animation-name: missionSparkle4; }
.mission-sparkle:nth-child(5) { animation-name: missionSparkle5; }
@keyframes missionSparkle1 { 0% { opacity:0; transform:translate(-50%,-50%) translate(0,0) scale(0.5); } 30% { opacity:1; transform:translate(-50%,-50%) translate(-60px,-80px) scale(1); } 100% { opacity:0; transform:translate(-50%,-50%) translate(-90px,-120px) scale(1.2); } }
@keyframes missionSparkle2 { 0% { opacity:0; transform:translate(-50%,-50%) translate(0,0) scale(0.5); } 30% { opacity:1; transform:translate(-50%,-50%) translate(60px,-80px) scale(1); } 100% { opacity:0; transform:translate(-50%,-50%) translate(90px,-120px) scale(1.2); } }
@keyframes missionSparkle3 { 0% { opacity:0; transform:translate(-50%,-50%) translate(0,0) scale(0.5); } 30% { opacity:1; transform:translate(-50%,-50%) translate(-80px,20px) scale(1); } 100% { opacity:0; transform:translate(-50%,-50%) translate(-120px,40px) scale(1.2); } }
@keyframes missionSparkle4 { 0% { opacity:0; transform:translate(-50%,-50%) translate(0,0) scale(0.5); } 30% { opacity:1; transform:translate(-50%,-50%) translate(80px,20px) scale(1); } 100% { opacity:0; transform:translate(-50%,-50%) translate(120px,40px) scale(1.2); } }
@keyframes missionSparkle5 { 0% { opacity:0; transform:translate(-50%,-50%) translate(0,0) scale(0.5); } 30% { opacity:1; transform:translate(-50%,-50%) translate(0,-100px) scale(1.2); } 100% { opacity:0; transform:translate(-50%,-50%) translate(0,-150px) scale(1.4); } }

@media (max-width: 420px) {
  .mission-complete-stage {
    padding: 32px 28px;
    margin: 12px;
    width: calc(100vw - 24px);
    max-width: none;
    min-width: 0;
  }
  .mission-complete-badge { font-size: 3.5rem; }
  .mission-complete-title { font-size: 1.3rem; }
  .mission-complete-rewards { font-size: 1rem; }
  .mission-complete-stars, .mission-complete-xp { font-size: 1.2rem; white-space: normal; max-width: 100%; }
}

/* ── 비밀의 장 완료 팝업 (스토리 전용 컨셉) ── */
.story-reward-overlay {
  background: rgba(0, 0, 0, 0.82);
}
.story-reward-overlay .story-reward-stage {
  background: linear-gradient(160deg, #1e1b2e 0%, #2d2640 50%, #252035 100%);
  border: 1px solid rgba(196, 167, 125, 0.55);
  border-radius: 14px;
  box-shadow: inset 0 1px 0 rgba(196, 167, 125, 0.12), 0 0 40px rgba(196, 167, 125, 0.15), 0 12px 40px rgba(0, 0, 0, 0.5);
  padding: 28px 32px;
}
.story-reward-overlay .story-reward-badge {
  font-size: 3.2rem;
  filter: drop-shadow(0 0 12px rgba(196, 167, 125, 0.4));
}
.story-reward-overlay .story-reward-stage .mission-complete-title {
  color: #e8dcc8;
  font-weight: 700;
  text-shadow: 0 0 20px rgba(196, 167, 125, 0.2);
}
.story-reward-overlay .story-reward-stage .mission-complete-sub {
  color: #a89b8a;
  font-size: 0.95rem;
}
.story-reward-overlay .story-reward-stage .mission-complete-stars {
  color: #c4a77d;
  font-weight: 700;
  text-shadow: 0 0 14px rgba(196, 167, 125, 0.3);
}
.story-reward-overlay .story-reward-stage .mission-complete-xp {
  color: #b8a888;
  font-weight: 600;
  text-shadow: 0 0 8px rgba(184, 168, 136, 0.2);
}
.story-reward-overlay .story-reward-stage .mission-complete-btn {
  margin-top: 14px;
  padding: 10px 24px;
  background: linear-gradient(180deg, rgba(45, 38, 64, 0.95) 0%, rgba(30, 27, 46, 0.98) 100%);
  color: #e8dcc8;
  border: 1px solid rgba(196, 167, 125, 0.5);
  border-radius: 10px;
  font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(196, 167, 125, 0.1);
}
.story-reward-overlay .story-reward-stage .mission-complete-btn:hover {
  background: linear-gradient(180deg, rgba(55, 48, 75, 0.98) 0%, rgba(40, 35, 58, 0.98) 100%);
  border-color: rgba(196, 167, 125, 0.65);
  color: #f0e6d8;
}
.story-reward-sparkles .mission-sparkle {
  opacity: 0.6;
}

/* ═══════════════════════════════════════════════════════════
   펫 카드 (홈 화면)
   ═══════════════════════════════════════════════════════════ */
.pet-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  animation: fadeIn 0.45s ease;
}

.pet-card.pet-egg {
  border-style: dashed;
  border-color: #f59e0b;
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  opacity: 1;
  cursor: default;
}
.pet-card.pet-egg .pet-emoji {
  animation: eggWobble 2.5s ease-in-out infinite;
  font-size: 3.2rem;
  filter: drop-shadow(0 0 8px rgba(245, 158, 11, 0.4));
}
/* 금 테두리 빛남 */
.pet-card.pet-egg::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background: linear-gradient(135deg, #f59e0b, #fbbf24, #f59e0b);
  z-index: -1;
  animation: eggGlow 2s ease-in-out infinite alternate;
}
/* 균열 이펙트 */
.pet-egg .egg-crack {
  position: absolute;
  top: 30%; left: 42%;
  font-size: 0.85rem;
  opacity: 0;
  animation: eggCrackPulse 3.5s ease-in-out infinite;
  pointer-events: none;
}

/* ── 부화 전환 오버레이 ── */
.egg-hatch-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.7);
  animation: hatchBgFadeIn 0.5s ease;
}
.egg-hatch-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.egg-hatch-egg {
  font-size: 6rem;
  filter: drop-shadow(0 0 24px rgba(255,200,0,0.6));
}
.egg-hatch-egg.shaking {
  animation: eggShakeHard 0.12s linear infinite;
}
.egg-hatch-egg.cracking {
  animation: eggShakeHard 0.08s linear infinite;
  filter: drop-shadow(0 0 40px rgba(255,200,0,0.9));
}
.egg-hatch-egg.explode {
  animation: eggExplode 0.6s ease forwards;
}
.egg-hatch-text {
  color: #fff;
  font-size: 1.2rem;
  font-weight: 700;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
  animation: fadeIn 0.5s ease;
}
.egg-hatch-flash {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(255,255,200,0.9) 0%, transparent 70%);
  opacity: 0;
  animation: hatchFlash 1s ease forwards;
  pointer-events: none;
}
.egg-hatch-sparkles {
  position: absolute;
  font-size: 2rem;
  pointer-events: none;
}
.hatch-sparkle {
  position: absolute;
  animation: hatchSparkleFly 1s ease forwards;
  opacity: 0;
}

/* ── 알 관련 키프레임들 ── */
@keyframes eggWobble {
  0%, 100% { transform: rotate(0deg) scale(1); }
  10% { transform: rotate(-6deg) scale(1.02); }
  20% { transform: rotate(6deg) scale(1.02); }
  30% { transform: rotate(-4deg) scale(1); }
  40% { transform: rotate(4deg) scale(1); }
  50% { transform: rotate(0deg) scale(1); }
}
@keyframes eggGlow {
  0% { opacity: 0.4; }
  100% { opacity: 0.8; }
}
@keyframes eggCrackPulse {
  0%, 40%, 100% { opacity: 0; transform: scale(0.8); }
  45%, 55% { opacity: 0.7; transform: scale(1); }
  60% { opacity: 0.3; transform: scale(1.1); }
}
@keyframes eggShakeHard {
  0% { transform: translateX(-3px) rotate(-2deg); }
  25% { transform: translateX(3px) rotate(2deg); }
  50% { transform: translateX(-2px) rotate(-1deg); }
  75% { transform: translateX(2px) rotate(1deg); }
  100% { transform: translateX(-3px) rotate(-2deg); }
}
@keyframes eggExplode {
  0% { transform: scale(1); opacity: 1; }
  30% { transform: scale(1.4); opacity: 1; }
  100% { transform: scale(3); opacity: 0; filter: brightness(3); }
}
@keyframes hatchBgFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes hatchFlash {
  0% { opacity: 0; }
  30% { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes hatchSparkleFly {
  0% { opacity: 1; transform: translate(0,0) scale(1); }
  100% { opacity: 0; transform: translate(var(--sx), var(--sy)) scale(0.3); }
}
/* 균열선 그리기 애니메이션 */
@keyframes crackDraw {
  to { stroke-dashoffset: 0; }
}
/* 미세 진동 (금 갈 때) */
@keyframes eggMicroShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-2px) rotate(-1deg); }
  75% { transform: translateX(2px) rotate(1deg); }
}
/* 껍질 조각 날아감 */
@keyframes shellFly {
  0% { opacity: 1; transform: translate(0,0) rotate(0deg) scale(1); }
  100% { opacity: 0; transform: translate(var(--sx), var(--sy)) rotate(360deg) scale(0.2); }
}
/* 균열 SVG 컨테이너 */
.egg-crack-svg {
  transition: opacity 0.2s;
}
.crack-line {
  opacity: 0;
  transition: stroke 0.3s, stroke-width 0.3s, filter 0.3s;
}

.pet-emoji {
  font-size: 2.8rem;
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: float 3s ease-in-out infinite;
}

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

.pet-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}

.pet-card .pet-name-edit-btn {
  flex-shrink: 0;
  background: transparent;
  border: none;
  padding: 2px 4px;
  font-size: 0.9rem;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s;
}
.pet-card .pet-name-edit-btn:hover {
  opacity: 1;
}

.pet-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}

.pet-stage-label {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  margin-left: 6px;
  vertical-align: middle;
  text-transform: uppercase;
}

.pet-evo-text {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.pet-card-clickable {
  cursor: pointer;
  transition: transform 0.15s, border-color 0.2s;
}
.pet-card-clickable:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.pet-card-goto-wrap {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  flex-shrink: 0;
  line-height: 1;
}
.pet-card-goto-label {
  font-size: 0.8rem;
  color: var(--accent, #1cb0f6);
  font-weight: 500;
  line-height: 1;
}
.pet-card-arrow {
  font-size: 0.8rem;
  color: var(--text-dim);
  font-weight: 700;
  line-height: 1;
  transform: translateY(-0.12em);
}

.pet-evo-bar {
  height: 6px;
}
.pet-card-xp-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}
.pet-card-xp-row .pet-evo-bar {
  flex: 1;
}
.pet-card-xp-val {
  font-size: 0.7rem;
  font-weight: 600;
  color: #64748b;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════
   펫 서식지 (Pet Habitat)
   ═══════════════════════════════════════════════════════════ */
/* 펫 뷰일 때 상단 잘림 방지 (여유 있게) */
.container.view-pet {
  padding-top: 36px;
}
.view-pet .pet-header-actions {
  margin-top: 0;
}
.view-pet .pet-habitat {
  margin-top: 8px;
}

.pet-habitat {
  border-radius: var(--radius);
  overflow-x: hidden;
  overflow-y: visible;
  position: relative;
  height: 388px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  animation: fadeIn 0.4s ease;
  padding-top: 28px;
  box-sizing: border-box;
}

.habitat-sky {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.habitat-star {
  position: absolute;
  color: rgba(255,255,255,0.5);
  font-size: 0.8rem;
  animation: twinkle 3s ease-in-out infinite;
}

@keyframes twinkle {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.2); }
}

.habitat-pet-area {
  position: absolute;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  z-index: 2;
}

/* ── 로밍 (좌우 이동 — transform only, GPU 가속) ── */
.habitat-pet-area.pet-roaming {
  animation: petRoam 12s ease-in-out infinite;
  will-change: transform;
}
.habitat-pet-area.pet-roaming-energetic {
  animation: petRoamEnergetic 8s ease-in-out infinite;
  will-change: transform;
}
.habitat-pet-area.pet-roaming-slow {
  animation: petRoamSlow 16s ease-in-out infinite;
  will-change: transform;
}
.habitat-pet-area.pet-static {
  left: 50%;
  transform: translateX(-50%);
  animation: none;
}

@keyframes petRoam {
  0%   { transform: translateX(-50%) scaleX(1); }
  20%  { transform: translateX(calc(-50% + 80px)) scaleX(1); }
  25%  { transform: translateX(calc(-50% + 80px)) scaleX(-1); }
  45%  { transform: translateX(-50%) scaleX(-1); }
  50%  { transform: translateX(-50%) scaleX(-1); }
  70%  { transform: translateX(calc(-50% - 80px)) scaleX(-1); }
  75%  { transform: translateX(calc(-50% - 80px)) scaleX(1); }
  95%  { transform: translateX(-50%) scaleX(1); }
  100% { transform: translateX(-50%) scaleX(1); }
}
@keyframes petRoamEnergetic {
  0%   { transform: translateX(-50%) scaleX(1); }
  15%  { transform: translateX(calc(-50% + 100px)) scaleX(1); }
  20%  { transform: translateX(calc(-50% + 100px)) scaleX(-1); }
  40%  { transform: translateX(-50%) scaleX(-1); }
  50%  { transform: translateX(-50%) scaleX(-1); }
  65%  { transform: translateX(calc(-50% - 100px)) scaleX(-1); }
  70%  { transform: translateX(calc(-50% - 100px)) scaleX(1); }
  90%  { transform: translateX(-50%) scaleX(1); }
  100% { transform: translateX(-50%) scaleX(1); }
}
@keyframes petRoamSlow {
  0%   { transform: translateX(-50%) scaleX(1); }
  25%  { transform: translateX(calc(-50% + 50px)) scaleX(1); }
  30%  { transform: translateX(calc(-50% + 50px)) scaleX(-1); }
  50%  { transform: translateX(-50%) scaleX(-1); }
  55%  { transform: translateX(-50%) scaleX(-1); }
  75%  { transform: translateX(calc(-50% - 50px)) scaleX(-1); }
  80%  { transform: translateX(calc(-50% - 50px)) scaleX(1); }
  100% { transform: translateX(-50%) scaleX(1); }
}

/* 펫 래퍼 (그림자 + 펫) */
.habitat-pet-wrap {
  position: relative;
  display: inline-block;
}

/* 그림자 (착지 시 눌림 연출) */
.habitat-pet-shadow {
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 56px;
  height: 14px;
  background: radial-gradient(ellipse 70% 50% at center, rgba(0,0,0,0.35) 0%, rgba(0,0,0,0.1) 60%, transparent 100%);
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
}
/* 착지 충격파 (점프 시) */
.habitat-pet-shadow[data-jump]::before,
.habitat-pet-shadow[data-jump]::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  border-radius: 50%;
  pointer-events: none;
}
.habitat-pet-shadow[data-jump]::before {
  width: 90px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.4);
  animation: landingRing 0.5s ease-out 0.5s forwards;
}
.habitat-pet-shadow[data-jump="pet-jump-high"]::before {
  width: 120px;
  height: 24px;
  animation: landingRing 0.6s ease-out 0.7s forwards;
}
.habitat-pet-shadow[data-jump]::after {
  width: 60px;
  height: 16px;
  border: 1.5px solid rgba(255,255,255,0.25);
  animation: landingRing 0.5s ease-out 0.55s forwards;
}
.habitat-pet-shadow[data-jump="pet-jump-high"]::after {
  animation: landingRing 0.6s ease-out 0.75s forwards;
}
@keyframes landingRing {
  0%   { transform: translate(-50%, -50%) scale(0.2); opacity: 0.8; }
  60%  { transform: translate(-50%, -50%) scale(1.6); opacity: 0.3; }
  100% { transform: translate(-50%, -50%) scale(2); opacity: 0; }
}
.habitat-pet-shadow[data-jump="pet-jump-low"] {
  animation: shadowJumpLow 0.8s cubic-bezier(0.2, 0.8, 0.3, 1) forwards !important;
}
.habitat-pet-shadow[data-jump="pet-jump-mid"] {
  animation: shadowJumpMid 1s cubic-bezier(0.2, 0.8, 0.3, 1) forwards !important;
}
.habitat-pet-shadow[data-jump="pet-jump-high"] {
  animation: shadowJumpHigh 1.2s cubic-bezier(0.2, 0.8, 0.3, 1) forwards !important;
}
.habitat-pet-shadow[data-behavior="pet-normal"] {
  animation: shadowWiggle 4s ease-in-out infinite;
}
.habitat-pet-shadow[data-behavior="pet-bored"],
.habitat-pet-shadow[data-behavior="pet-sleepy"] {
  animation: shadowSway 5s ease-in-out infinite;
}
.habitat-pet-shadow[data-behavior="pet-dirty"] {
  animation: shadowShake 3s ease-in-out infinite;
}
@keyframes shadowJumpLow {
  0%   { transform: translateX(-50%) scale(1.3, 0.5); opacity: 0.55; }
  8%   { transform: translateX(-50%) scale(1.5, 0.35); opacity: 0.65; }
  40%  { transform: translateX(-50%) scale(0.6, 0.8); opacity: 0.15; }
  85%  { transform: translateX(-50%) scale(1.5, 0.35); opacity: 0.65; }
  100% { transform: translateX(-50%) scale(1.3, 0.5); opacity: 0.55; }
}
@keyframes shadowJumpMid {
  0%   { transform: translateX(-50%) scale(1.3, 0.5); opacity: 0.55; }
  6%   { transform: translateX(-50%) scale(1.6, 0.3); opacity: 0.7; }
  35%  { transform: translateX(-50%) scale(0.35, 0.9); opacity: 0.08; }
  78%  { transform: translateX(-50%) scale(1.6, 0.3); opacity: 0.7; }
  100% { transform: translateX(-50%) scale(1.3, 0.5); opacity: 0.55; }
}
@keyframes shadowJumpHigh {
  0%   { transform: translateX(-50%) scale(1.3, 0.5); opacity: 0.55; }
  5%   { transform: translateX(-50%) scale(1.8, 0.2); opacity: 0.8; }
  30%  { transform: translateX(-50%) scale(0.15, 1); opacity: 0.03; }
  72%  { transform: translateX(-50%) scale(1.8, 0.2); opacity: 0.8; }
  100% { transform: translateX(-50%) scale(1.3, 0.5); opacity: 0.55; }
}

@keyframes shadowWiggle {
  0%, 100% { transform: translateX(-50%) scale(1.2, 0.6); opacity: 0.5; }
  50% { transform: translateX(-50%) scale(1.1, 0.65); opacity: 0.45; }
}
@keyframes shadowSway {
  0%, 100% { transform: translateX(-50%) scale(1.15, 0.55); opacity: 0.5; }
  50% { transform: translateX(-50%) scale(1.1, 0.6); opacity: 0.45; }
}
@keyframes shadowShake {
  0%, 100% { transform: translateX(-50%) scale(1.2, 0.5); opacity: 0.55; }
  50% { transform: translateX(-50%) scale(1.1, 0.6); opacity: 0.45; }
}

.habitat-pet {
  font-size: 5rem;
  line-height: 1;
  animation: petBob 3s ease-in-out infinite;
  cursor: default;
  transition: transform 0.2s;
  position: relative;
  z-index: 1;
}

.habitat-pet:hover {
  transform: scale(1.1);
}
.pet-accessory {
  position: absolute;
  top: -0.4em;
  left: 50%;
  transform: translateX(-50%);
  line-height: 1;
  pointer-events: none;
  z-index: 2;
}

/* 기분별 펫 동작 (강화) */
@keyframes petBob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}
.habitat-pet.pet-normal {
  animation: petWiggle 4s ease-in-out infinite;
}
@keyframes petWiggle {
  0% { transform: translateY(0) rotate(0deg) scale(1); }
  12% { transform: translateY(-18px) rotate(3deg) scale(1.03); }
  25% { transform: translateY(-6px) rotate(-2deg) scale(0.98); }
  37% { transform: translateY(-22px) rotate(-3deg) scale(1.04); }
  50% { transform: translateY(-4px) rotate(2deg) scale(0.99); }
  62% { transform: translateY(-16px) rotate(2deg) scale(1.02); }
  75% { transform: translateY(-8px) rotate(-1deg) scale(0.97); }
  87% { transform: translateY(-20px) rotate(-2deg) scale(1.03); }
  100% { transform: translateY(0) rotate(0deg) scale(1); }
}
/* ── 단발 점프 3종 (JS에서 랜덤 트리거) ── */
.habitat-pet.pet-jump-low {
  animation: petJumpLow 0.8s cubic-bezier(0.2, 0.8, 0.3, 1) forwards !important;
}
@keyframes petJumpLow {
  0%   { transform: translateY(0) scale(1, 1); }
  8%   { transform: translateY(6px) scale(1.1, 0.82); }
  40%  { transform: translateY(-80px) scale(0.9, 1.12); }
  65%  { transform: translateY(-20px) scale(0.95, 1.05); }
  85%  { transform: translateY(4px) scale(1.08, 0.88); }
  100% { transform: translateY(0) scale(1, 1); }
}
.habitat-pet.pet-jump-mid {
  animation: petJumpMid 1s cubic-bezier(0.2, 0.8, 0.3, 1) forwards !important;
}
@keyframes petJumpMid {
  0%   { transform: translateY(0) scale(1, 1); }
  6%   { transform: translateY(8px) scale(1.14, 0.78); }
  35%  { transform: translateY(-200px) scale(0.85, 1.18); }
  55%  { transform: translateY(-50px) scale(0.92, 1.08); }
  78%  { transform: translateY(5px) scale(1.1, 0.85); }
  100% { transform: translateY(0) scale(1, 1); }
}
.habitat-pet.pet-jump-high {
  animation: petJumpHigh 1.2s cubic-bezier(0.2, 0.8, 0.3, 1) forwards !important;
}
@keyframes petJumpHigh {
  0%   { transform: translateY(0) scale(1, 1); }
  5%   { transform: translateY(12px) scale(1.2, 0.7); }
  30%  { transform: translateY(-500px) scale(0.8, 1.25); }
  50%  { transform: translateY(-120px) scale(0.88, 1.12); }
  72%  { transform: translateY(6px) scale(1.12, 0.82); }
  100% { transform: translateY(0) scale(1, 1); }
}
.habitat-pet.pet-bored {
  animation: petSway 5s ease-in-out infinite;
}
@keyframes petSway {
  0% { transform: translateY(6px) rotate(-8deg) scale(0.98); }
  25% { transform: translateY(2px) rotate(6deg) scale(1); }
  50% { transform: translateY(8px) rotate(8deg) scale(0.97); }
  75% { transform: translateY(4px) rotate(-6deg) scale(0.99); }
  100% { transform: translateY(6px) rotate(-8deg) scale(0.98); }
}
.habitat-pet.pet-sleepy {
  animation: petDoze 4s ease-in-out infinite;
}
@keyframes petDoze {
  0%, 100% { transform: translateY(0) scale(0.97) rotate(0deg); }
  20% { transform: translateY(4px) scale(0.95) rotate(-4deg); }
  40% { transform: translateY(2px) scale(0.96) rotate(3deg); }
  60% { transform: translateY(6px) scale(0.94) rotate(4deg); }
  80% { transform: translateY(3px) scale(0.95) rotate(-3deg); }
}
.habitat-pet.pet-dirty {
  animation: petShake 3s ease-in-out infinite;
}
@keyframes petShake {
  0%, 100% { transform: translateY(0) translateX(0) rotate(0deg); }
  10% { transform: translateY(-8px) translateX(4px) rotate(4deg); }
  25% { transform: translateY(-4px) translateX(-5px) rotate(-5deg); }
  40% { transform: translateY(-10px) translateX(3px) rotate(3deg); }
  55% { transform: translateY(-2px) translateX(-4px) rotate(-4deg); }
  70% { transform: translateY(-9px) translateX(5px) rotate(5deg); }
  85% { transform: translateY(-5px) translateX(-3px) rotate(-3deg); }
}

/* ── 캐릭터 위 need 힌트 (배고픔/청소/심심함 번갈아 표시, 말풍선과 겹치지 않음) ── */
.pet-need-hint-wrap {
  height: 36px;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.pet-need-hint {
  font-size: 1.75rem;
  line-height: 1;
  animation: needHintPulse 2s ease-in-out infinite;
  pointer-events: none;
}
@keyframes needHintPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.85; transform: scale(1.15); }
}

/* ── 말풍선: need 힌트 있을 땐 그 아래, 없을 땐 캐릭터 위 ── */
.pet-speech-bubble {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  color: #1a1a2e;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 16px;
  white-space: nowrap;
  z-index: 10;
  pointer-events: none;
  box-shadow: 0 3px 10px rgba(0,0,0,0.25);
  animation: speechPop 2.8s ease forwards;
}
.habitat-pet-area.has-need-hint .pet-speech-bubble {
  bottom: 100%;
  top: auto;
  margin-bottom: 4px;
}
.habitat-pet-area:not(.has-need-hint) .pet-speech-bubble {
  bottom: 100%;
  top: auto;
  margin-bottom: 8px;
}
.pet-speech-bubble::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #fff;
}

@keyframes speechPop {
  0%   { opacity: 0; transform: translateX(-50%) scale(0.3) translateY(6px); }
  10%  { opacity: 1; transform: translateX(-50%) scale(1.05) translateY(0); }
  15%  { opacity: 1; transform: translateX(-50%) scale(1) translateY(0); }
  75%  { opacity: 1; transform: translateX(-50%) scale(1) translateY(0); }
  100% { opacity: 0; transform: translateX(-50%) scale(0.8) translateY(-8px); }
}

.habitat-mood {
  margin-top: 4px;
  font-size: 0.85rem;
  color: rgba(255,255,255,0.7);
  font-weight: 600;
  background: rgba(0,0,0,0.3);
  padding: 4px 14px;
  border-radius: 999px;
  display: block;
  backdrop-filter: blur(4px);
  white-space: nowrap;
}

.habitat-ground {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 50px;
  border-top: 2px solid rgba(255,255,255,0.08);
}

/* 펫 정보 패널 */
.pet-info-panel {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  animation: fadeIn 0.5s ease;
}

.pet-info-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 2px;
}

.pet-info-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.pet-info-name-row .pet-name-edit-btn {
  flex-shrink: 0;
  margin-left: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: none;
  padding: 4px 8px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-dim);
  cursor: pointer;
  border-radius: 6px;
  transition: color 0.2s, background 0.2s;
}
.pet-info-name-row .pet-name-edit-btn:hover {
  color: var(--accent);
  background: rgba(0,0,0,0.04);
}
.pet-info-name-row .pet-name-edit-icon {
  font-size: 0.9rem;
}
.pet-info-name-row .pet-name-edit-label {
  font-size: 0.82rem;
  font-weight: 600;
}

.pet-info-name {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text);
}

.pet-stage-badge {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pet-info-type {
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-bottom: 16px;
}

.pet-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 8px;
}
.pet-battle-record {
  text-align: center;
  font-size: 0.82rem;
  font-weight: 700;
  margin-bottom: 16px;
  padding: 6px 0;
  background: #f8fafc;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}
.pet-battle-record .record-win { color: #22c55e; margin-right: 6px; }
.pet-battle-record .record-draw { color: #f59e0b; margin-right: 6px; }
.pet-battle-record .record-lose { color: #ef4444; }

.pet-stat {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 12px 8px;
  text-align: center;
}

.pet-stat-icon {
  font-size: 1.2rem;
  margin-bottom: 2px;
}

.pet-stat-value {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--duo-green);
  line-height: 1.2;
}

.pet-stat-label {
  font-size: 0.68rem;
  color: var(--text-dim);
  font-weight: 600;
  margin-top: 1px;
}

/* XP 레벨 섹션 */
.pet-xp-section {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 12px;
}
.pet-xp-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 6px;
}
.pet-xp-val {
  color: var(--text-dim);
  font-weight: 500;
  font-size: 0.8rem;
}
.pet-xp-bar {
  height: 10px !important;
}
.pet-xp-fill {
  background: linear-gradient(90deg, #8b5cf6, #a78bfa) !important;
  border-radius: 6px;
  transition: width 0.5s ease;
}

/* 레벨업 토스트 */
.levelup-toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #7c3aed, #a78bfa);
  color: #fff;
  padding: 12px 24px;
  border-radius: 30px;
  font-size: 1rem;
  font-weight: 700;
  z-index: 99999;
  box-shadow: 0 4px 20px rgba(124,58,237,0.4);
  animation: toastIn 0.4s ease;
}
.levelup-toast.toast-out {
  animation: toastOut 0.5s ease forwards;
}
@keyframes toastOut {
  to { opacity: 0; transform: translateX(-50%) translateY(-30px); }
}

/* 진화 섹션 */
.pet-evo-section {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 14px;
}

.pet-evo-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.pet-evo-pct {
  color: var(--duo-green);
}

.evo-detail-btn {
  font-size: 0.75rem;
  padding: 4px 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-dim);
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s, color 0.2s;
}
.evo-detail-btn:hover {
  background: var(--surface3);
  color: var(--text);
}

/* 진화 상세 모달 */
.evo-detail-overlay .evo-detail-card {
  max-width: 360px;
}
.evo-detail-stages {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 8px;
  padding: 20px 0;
  margin-bottom: 12px;
}
.evo-detail-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.evo-detail-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-dim);
}
.evo-detail-img {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 90px;
}
.evo-detail-img .evo-stage-preview,
.evo-detail-img .pet-img {
  max-width: 80px;
  max-height: 80px;
  object-fit: contain;
}
.evo-detail-img .evo-egg {
  font-size: 3rem;
}

@media (max-width: 600px) {
  .evo-detail-overlay .evo-detail-card {
    max-width: min(94vw, 340px);
    margin: 0 12px;
    padding: 14px 12px;
  }
  .evo-detail-stages {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px 4px;
    padding: 12px 0;
    width: 100%;
    box-sizing: border-box;
  }
  .evo-detail-stage {
    flex: none;
    min-width: 0;
    max-width: none;
  }
  .evo-detail-label {
    font-size: 0.65rem;
  }
  .evo-detail-img {
    min-height: 56px;
  }
  .evo-detail-img .evo-stage-preview,
  .evo-detail-img .pet-img {
    max-width: 100%;
    max-height: 52px;
    width: auto;
    height: auto;
  }
  .evo-detail-img .evo-egg {
    font-size: 1.8rem;
  }
}

.pet-home-evo-bar {
  height: 10px;
  margin-bottom: 8px;
}

.pet-evo-detail {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-bottom: 14px;
}

/* 진화 타임라인 */
.pet-evo-timeline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding-top: 6px;
}

.evo-step {
  text-align: center;
}

.evo-emoji {
  font-size: 1.6rem;
  line-height: 1;
  margin-bottom: 2px;
}

.evo-label {
  font-size: 0.6rem;
  font-weight: 600;
}

.evo-arrow {
  font-size: 0.8rem;
  margin: 0 2px;
  padding-bottom: 14px;
}

.evo-unlocked .evo-emoji { filter: none; }
.evo-unlocked .evo-label { color: var(--duo-green); }
.evo-unlocked { opacity: 1; }

.evo-locked .evo-emoji { filter: grayscale(1) brightness(0.5); }
.evo-locked .evo-label { color: var(--text-dim); }
.evo-locked { opacity: 0.4; }

.pet-home-empty {
  text-align: center;
  padding: 60px 20px;
}

.pet-home-egg {
  font-size: 4rem;
  margin-bottom: 16px;
  animation: float 3s ease-in-out infinite;
}

/* ═══════════════════════════════════════════════════════════
   스테이지 경로 (작은 디딤돌, 세로 가운데 한 줄)
   ═══════════════════════════════════════════════════════════ */
.path-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  padding: 10px 0 20px;
  position: relative;
}

.path-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 8px 16px 10px;
  position: relative;
  animation: fadeIn 0.35s ease backwards;
  transition: transform 0.15s;
}

.path-node:hover { transform: scale(1.05); }
.path-node:active { transform: scale(0.97); }

/* 연결선 */
.path-connector {
  width: 3px;
  height: 22px;
  border-left: 3px dashed var(--border);
  position: absolute;
  top: -22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 0;
}

.path-done .path-connector {
  border-left-color: var(--duo-green);
}

/* 원형 노드 (작은 디딤돌) */
.path-circle {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 800;
  flex-shrink: 0;
  transition: all 0.25s;
  position: relative;
  z-index: 1;
}

/* 완료 상태 */
.path-done .path-circle {
  background: var(--duo-green);
  border: 3px solid var(--duo-green2);
  color: #fff;
  font-size: 1.5rem;
  box-shadow: 0 4px 16px rgba(88, 204, 2, 0.3);
}

/* 현재 진행중 */
.path-current .path-circle {
  background: var(--surface);
  border: 3px solid var(--duo-green);
  color: var(--duo-green);
  box-shadow: 0 0 0 6px rgba(88, 204, 2, 0.15);
  animation: pathPulse 2s ease-in-out infinite;
}

/* 미진행 */
.path-upcoming .path-circle {
  background: var(--surface2);
  border: 3px solid var(--border);
  color: var(--text-dim);
}

/* 라벨 */
.path-label {
  text-align: center;
}

.path-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}

.path-done .path-title { color: var(--duo-green); }

.path-meta {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.path-stars {
  font-size: 0.7rem;
  letter-spacing: -1px;
}

@keyframes pathPulse {
  0%, 100% { box-shadow: 0 0 0 6px rgba(88, 204, 2, 0.15); }
  50% { box-shadow: 0 0 0 12px rgba(88, 204, 2, 0.08); }
}

/* ═══════════════════════════════════════════════════════════
   펫 선택 모달
   ═══════════════════════════════════════════════════════════ */
.pet-options {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.pet-option {
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 6px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s, background 0.2s;
}

.pet-option:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.pet-option.selected {
  border-color: var(--duo-green);
  background: var(--green-bg);
  box-shadow: 0 0 0 3px rgba(88, 204, 2, 0.2);
}

.pet-option-emoji {
  font-size: 2rem;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 80px;
}

.pet-option-name {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-dim);
}

.pet-option.selected .pet-option-name {
  color: var(--duo-green);
}

/* ── 펫 스킬 미리보기 (선택 모달) ── */
.pet-choice-card {
  max-width: 440px;
  max-height: 95vh;
  overflow-y: auto;
  padding: 16px 14px;
}
.pet-skill-preview {
  display: none;
  margin-bottom: 10px;
  max-height: 35vh;
  overflow-y: auto;
}
.pet-skill-preview.active {
  display: block;
  animation: fadeIn 0.3s ease;
}
.pet-skill-preview-hint {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.82rem;
  padding: 16px 0;
}
.pet-skill-preview-header {
  padding: 8px 12px;
  margin-bottom: 8px;
  background: var(--bg);
  border-radius: var(--radius-sm);
}
.pet-skill-preview-title {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 2px;
}
.pet-skill-preview-desc {
  font-size: 0.78rem;
  color: var(--text-dim);
}
.pet-skill-gate {
  margin-bottom: 8px;
}
.pet-skill-gate.master {
  border: 1px solid #f59e0b;
  border-radius: var(--radius-sm);
  padding: 6px;
  background: rgba(245,158,11,0.05);
}
.pet-skill-gate-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 4px;
  padding-left: 2px;
}
.pet-skill-gate.master .pet-skill-gate-label {
  color: #f59e0b;
}
.pet-skill-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 5px;
}
.pet-skill-item-top {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 3px;
}
.pet-skill-kind-badge {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 600;
  color: #fff;
  padding: 1px 6px;
  border-radius: 8px;
  white-space: nowrap;
}
.pet-skill-item-name {
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--text);
}
.pet-skill-item-desc {
  font-size: 0.72rem;
  color: var(--text-dim);
  line-height: 1.3;
}
.pet-skill-item.skill-view-equipped {
  border-color: #7c3aed;
  background: rgba(124,58,237,0.08);
}

/* 처음 몬스터 선택: 진화(변신) 미리보기 */
.pet-evo-preview {
  display: none;
  margin-bottom: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}
.pet-evo-preview.active {
  display: block;
  animation: fadeIn 0.3s ease;
}
.pet-evo-preview-hint {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.82rem;
  padding: 8px 0;
}
.pet-evo-preview-title {
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 10px;
  text-align: center;
  color: var(--text);
}
.pet-evo-preview-stages {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px 2px;
}
.pet-evo-preview-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.pet-evo-preview-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-dim);
}
.pet-evo-preview-img-wrap {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pet-evo-preview-img-wrap img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.pet-evo-preview-arrow {
  font-size: 0.9rem;
  color: var(--text-dim);
  margin: 0 2px;
  align-self: center;
}

/* 스킬보기 모달 */
.skill-view-modal-card {
  max-width: 420px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}
.skill-view-content {
  overflow-y: auto;
  flex: 1;
  min-height: 120px;
  margin-bottom: 12px;
  padding-right: 4px;
}
.skill-view-content .pet-skill-preview-header {
  margin-bottom: 12px;
}
.skill-view-content .pet-skill-gate {
  margin-bottom: 10px;
}

@media (max-width: 480px) {
  .pet-choice-card {
    max-width: 95vw;
    padding: 14px 10px;
    max-height: 95vh;
  }
  .pet-skill-preview-header { padding: 6px 8px; }
  .pet-skill-item { padding: 6px 8px; }
  .pet-skill-item-name { font-size: 0.78rem; }
  .pet-skill-item-desc { font-size: 0.68rem; }
  .pet-skill-gate-label { font-size: 0.68rem; }
}

/* ═══════════════════════════════════════════════════════════
   진화 오버레이 (풀 애니메이션)
   ═══════════════════════════════════════════════════════════ */
.evolve-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
  animation: hatchBgFadeIn 0.5s ease;
}

.evolve-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.evolve-pet-old {
  font-size: 5rem;
  filter: drop-shadow(0 0 20px rgba(255,200,0,0.5));
}
.evolve-pet-old.evolve-shine {
  animation: evolveShine 1.8s ease-in-out infinite;
}
.evolve-pet-old.evolve-pulse {
  animation: evolvePulseShake 0.15s linear infinite;
  filter: drop-shadow(0 0 40px rgba(255,200,0,0.9)) brightness(1.3);
}

.evolve-pet-new {
  font-size: 0;
  animation: evolveNewAppear 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  filter: drop-shadow(0 0 30px rgba(255,200,0,0.7));
}

.evolve-text {
  color: #fff;
  font-size: 1.2rem;
  font-weight: 700;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
  animation: fadeIn 0.5s ease;
}

/* 보상 카드 */
.evolve-reward-card {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  border: 2px solid var(--gold);
  border-radius: 16px;
  padding: 20px 24px;
  max-width: 320px;
  width: 100%;
  text-align: left;
  box-shadow: 0 0 40px rgba(255, 150, 0, 0.3);
  animation: evolveCardAppear 0.5s ease;
  margin-top: 8px;
}
.evolve-reward-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--gold);
  text-align: center;
  margin: 0 0 12px;
}
.evolve-reward-list {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
}
.evolve-reward-list li {
  color: #fff;
  font-size: 0.92rem;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.evolve-reward-list li:last-child {
  border-bottom: none;
}
.evolve-reward-card .modal-btn {
  width: 100%;
  margin-top: 4px;
}

/* 칭호 텍스트 (홈 펫 카드) */
.pet-title-text {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--gold);
  margin-bottom: 2px;
}
/* 칭호 배지 (펫 홈) */
.pet-title-badge {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--gold);
  margin-top: 2px;
  padding: 2px 10px;
  background: rgba(255,150,0,0.1);
  border: 1px solid rgba(255,150,0,0.3);
  border-radius: 999px;
  display: inline-block;
}
.clickable-title {
  cursor: pointer;
  transition: all 0.2s ease;
}
.clickable-title:hover, .clickable-title:active {
  background: rgba(255,150,0,0.2);
  transform: scale(1.03);
}
.title-edit-icon {
  font-size: 0.65rem;
  opacity: 0.6;
}

/* ── 칭호 선택 팝업 ── */
.title-select-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn 0.2s ease;
}
.title-select-card {
  background: #fff;
  border-radius: 20px;
  padding: 20px;
  width: 90vw;
  max-width: 360px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 40px rgba(0,0,0,0.25);
  animation: slideUp 0.3s ease;
}
.title-select-header {
  text-align: center;
  font-size: 1.1rem;
  margin: 0 0 4px;
  color: #1e1b4b;
}
.title-select-stats {
  text-align: center;
  font-size: 0.72rem;
  color: #9ca3af;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #f3f4f6;
}
.title-select-list {
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 4px;
}
.title-select-list::-webkit-scrollbar { width: 4px; }
.title-select-list::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 4px; }
.title-select-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 2px solid #e5e7eb;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-wrap: wrap;
}
.title-select-item:hover:not(.title-locked) {
  border-color: #a78bfa;
  background: #faf5ff;
}
.title-active {
  border-color: #7c3aed !important;
  background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%) !important;
}
.title-locked {
  cursor: not-allowed;
  background: #f3f4f6;
  border-color: #e5e7eb !important;
  opacity: 0.85;
}
.title-locked .title-select-name {
  color: #9ca3af !important;
}
.title-locked .title-select-desc {
  color: #9ca3af !important;
}
.title-select-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: #1e1b4b;
  flex: 1;
}
.title-select-desc {
  font-size: 0.68rem;
  color: #6b7280;
  width: 100%;
}
.title-skill-badge {
  font-size: 0.65rem;
  color: #7c3aed;
  font-weight: 600;
  background: rgba(124, 58, 237, 0.12);
  padding: 2px 6px;
  border-radius: 6px;
  margin-left: 4px;
}
.title-select-check {
  font-size: 0.7rem;
  color: #22c55e;
  font-weight: 700;
}
.title-select-lock {
  font-size: 0.65rem;
  color: #d1d5db;
  font-weight: 600;
  background: #f3f4f6;
  padding: 1px 6px;
  border-radius: 6px;
}
.title-select-close {
  margin-top: 12px;
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: 12px;
  background: #7c3aed;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
}
.title-select-close:active { background: #6d28d9; }

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

/* 재도전 별 알림 */
.replay-star-warn {
  background: rgba(245,158,11,0.12);
  border: 1px solid rgba(245,158,11,0.4);
  color: #b45309;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 10px;
  margin: 10px 0;
  animation: fadeIn 0.4s ease;
}
.replay-star-bonus {
  background: rgba(34,197,94,0.12);
  border: 1px solid rgba(34,197,94,0.4);
  color: #16a34a;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 10px;
  margin: 10px 0;
  animation: fadeIn 0.4s ease;
}

/* 페널티 경고 */
.penalty-warn {
  background: rgba(239,68,68,0.15);
  border: 1px solid rgba(239,68,68,0.4);
  color: #ef4444;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 10px;
  margin: 10px 0;
  animation: shake 0.5s ease;
}


/* ── 진화 키프레임 ── */
@keyframes evolveShine {
  0%, 100% { transform: scale(1) rotate(0deg); filter: drop-shadow(0 0 20px rgba(255,200,0,0.5)) brightness(1); }
  25% { transform: scale(1.05) rotate(-3deg); filter: drop-shadow(0 0 30px rgba(255,200,0,0.7)) brightness(1.15); }
  50% { transform: scale(1.1) rotate(0deg); filter: drop-shadow(0 0 40px rgba(255,200,0,0.9)) brightness(1.3); }
  75% { transform: scale(1.05) rotate(3deg); filter: drop-shadow(0 0 30px rgba(255,200,0,0.7)) brightness(1.15); }
}
@keyframes evolvePulseShake {
  0% { transform: translateX(-4px) rotate(-3deg); }
  25% { transform: translateX(4px) rotate(3deg); }
  50% { transform: translateX(-3px) rotate(-2deg); }
  75% { transform: translateX(3px) rotate(2deg); }
  100% { transform: translateX(-4px) rotate(-3deg); }
}
@keyframes evolveExplode {
  0% { transform: scale(1); opacity: 1; }
  40% { transform: scale(1.5); opacity: 1; filter: brightness(3); }
  100% { transform: scale(3); opacity: 0; }
}
@keyframes evolveNewAppear {
  0% { font-size: 0; opacity: 0; transform: scale(3) rotate(10deg); }
  60% { font-size: 6rem; opacity: 1; transform: scale(1.3) rotate(-5deg); }
  80% { font-size: 5.5rem; transform: scale(0.95) rotate(2deg); }
  100% { font-size: 5rem; transform: scale(1) rotate(0deg); }
}
@keyframes evolveCardAppear {
  0% { opacity: 0; transform: translateY(30px) scale(0.9); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* 이전 스타일 호환 (레거시) */
.evolve-card {
  background: var(--surface);
  border: 2px solid var(--gold);
  border-radius: 20px;
  padding: 36px 28px;
  max-width: 340px;
  width: 100%;
  text-align: center;
  box-shadow: 0 0 40px rgba(255, 150, 0, 0.2);
  animation: slideUp 0.4s ease;
}

.evolve-old {
  font-size: 3rem;
  display: inline-block;
  animation: evolveShrink 0.8s ease forwards;
}

.evolve-arrow {
  font-size: 2rem;
  color: var(--gold);
  display: inline-block;
  margin: 0 12px;
  vertical-align: middle;
  animation: fadeIn 0.4s ease 0.3s backwards;
}

.evolve-new {
  font-size: 3.5rem;
  display: inline-block;
  animation: evolveGrow 0.6s ease 0.5s backwards;
}

.evolve-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--gold);
  margin: 16px 0 6px;
  animation: fadeIn 0.3s ease 0.7s backwards;
}

.evolve-sub {
  font-size: 0.95rem;
  color: var(--text-dim);
  margin-bottom: 20px;
  animation: fadeIn 0.3s ease 0.9s backwards;
}

@keyframes evolveShrink {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(0.6); opacity: 0.5; }
  100% { transform: scale(0.8); opacity: 0.6; }
}

@keyframes evolveGrow {
  0% { transform: scale(0); opacity: 0; }
  60% { transform: scale(1.3); }
  100% { transform: scale(1); opacity: 1; }
}

/* ═══════════════════════════════════════════════════════════
   별 획득 표시 (완료 화면)
   ═══════════════════════════════════════════════════════════ */
.stars-earned {
  font-size: 1.5rem;
  margin-bottom: 8px;
  animation: starsSequence 1s cubic-bezier(0.68, -0.55, 0.265, 1.55) 0.4s backwards;
  display: inline-block;
}

@keyframes starsSequence {
  0% {
    transform: scale(0) rotate(-180deg);
    opacity: 0;
    filter: brightness(0);
  }
  60% {
    transform: scale(1.3) rotate(20deg);
    opacity: 1;
    filter: brightness(2);
  }
  80% {
    transform: scale(0.9) rotate(-10deg);
    filter: brightness(1.5);
  }
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
    filter: brightness(1);
  }
}

.xp-earned {
  font-size: 1.1rem;
  font-weight: 800;
  color: #7c3aed;
  margin-bottom: 20px;
  animation: xpBurst 0.7s cubic-bezier(0.68, -0.55, 0.265, 1.55) 0.6s backwards;
  display: inline-block;
}

@keyframes xpBurst {
  0% {
    transform: scale(0) translateY(30px);
    opacity: 0;
    text-shadow: 0 0 0 rgba(124, 58, 237, 0);
  }
  60% {
    transform: scale(1.4) translateY(-10px);
    opacity: 1;
    text-shadow: 0 0 30px rgba(124, 58, 237, 0.8);
  }
  80% {
    transform: scale(0.9) translateY(5px);
    text-shadow: 0 0 20px rgba(124, 58, 237, 0.6);
  }
  100% {
    transform: scale(1) translateY(0);
    opacity: 1;
    text-shadow: 0 0 10px rgba(124, 58, 237, 0.4);
  }
}

.xp-pop-badge {
  background: linear-gradient(135deg, rgba(124,58,237,0.1), rgba(167,139,250,0.15));
  display: inline-block;
  padding: 6px 16px;
  border-radius: 20px;
  border: 1px solid rgba(124,58,237,0.25);
}

@keyframes xpPop {
  from { transform: scale(0.5); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.stars-new {
  display: inline-block;
  background: var(--gold);
  color: #1a1a2e;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 999px;
  margin-left: 8px;
  vertical-align: middle;
  animation: fadeIn 0.3s ease 0.5s backwards;
}

/* ─── 진행률 바 ─── */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--duo-green);
  border-radius: 999px;
  transition: width 0.4s ease;
  position: relative;
}

.reset-btn {
  background: transparent;
  border: 2px solid var(--border);
  color: var(--text-dim);
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.reset-btn:hover { border-color: var(--red); color: var(--red); }

/* ═══════════════════════════════════════════════════════════
   플레이 화면 (문제 풀기)
   ═══════════════════════════════════════════════════════════ */
.play-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.play-close {
  margin-bottom: 0 !important;
  padding: 0 !important;
  font-size: 1.2rem !important;
  border-radius: 50% !important;
  width: 40px !important;
  height: 40px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: var(--surface) !important;
  border: 2px solid var(--border) !important;
}

.play-progress {
  flex: 1;
  height: 10px;
}

.play-counter {
  font-size: 0.85rem;
  color: var(--text-dim);
  font-weight: 700;
  white-space: nowrap;
}
.play-difficulty {
  font-size: 0.85rem;
  color: var(--gold, #f59e0b);
  letter-spacing: 1px;
  padding: 2px 6px;
  margin-left: auto;
}

.play-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 20px;
  animation: fadeIn 0.25s ease;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.3s;
  overflow: hidden;
  max-width: 100%;
}

.play-card.celebrate {
  border-color: var(--duo-green);
  animation: celebratePulse 0.4s ease;
}

.play-stem {
  font-size: 1.1rem;
  line-height: 1.8;
  margin-bottom: 20px;
  padding: 16px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  word-break: break-word;
  overflow-wrap: break-word;
}

.play-stem strong { color: var(--duo-green); }
.play-stem-wrap { position: relative; }
.report-error-btn {
  position: absolute;
  top: 0;
  right: 0;
  width: 25px;
  height: 25px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  font-size: 0.84rem;
  cursor: pointer;
  flex-shrink: 0;
}
.report-error-btn:hover { background: rgba(239, 68, 68, 0.3); }
.report-desc-ta { width: 100%; min-height: 80px; resize: vertical; }

/* ─── 선택지 (플레이) ─── */
.choices-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.choice-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
  font-weight: 500;
}

.choice-btn:hover:not(:disabled) {
  border-color: var(--accent);
  background: rgba(28, 176, 246, 0.08);
  transform: translateX(4px);
}

.choice-btn:active:not(:disabled) { transform: scale(0.99); }
.choice-btn:disabled { cursor: default; opacity: 0.85; }
.choice-btn.opp-turn-preview {
  opacity: 0.55;
  border-style: dashed;
  pointer-events: none;
}

.choice-btn.correct {
  border-color: var(--duo-green) !important;
  background: var(--green-bg) !important;
  color: var(--duo-green) !important;
  font-weight: 700;
  position: relative;
  animation: correctPop 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  box-shadow: 0 0 20px rgba(88, 204, 2, 0.4), 0 0 40px rgba(88, 204, 2, 0.2) !important;
}

.choice-btn.correct::before {
  content: '✓';
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%) scale(0);
  font-size: 1.5rem;
  animation: checkmarkPop 0.4s 0.2s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

.choice-btn.wrong {
  border-color: var(--red) !important;
  background: var(--red-bg) !important;
  color: var(--red) !important;
  position: relative;
  animation: wrongShakeHard 0.6s ease;
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.3) !important;
}

.choice-btn.wrong::before {
  content: '✗';
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.5rem;
  animation: crossShake 0.5s ease;
}

@keyframes correctPop {
  0% {
    transform: scale(0.9) translateX(0);
    opacity: 0.5;
  }
  50% {
    transform: scale(1.08) translateX(10px);
  }
  70% {
    transform: scale(0.97) translateX(5px);
  }
  100% {
    transform: scale(1.02) translateX(8px);
  }
}

@keyframes checkmarkPop {
  0% {
    transform: translateY(-50%) scale(0) rotate(-180deg);
    opacity: 0;
  }
  70% {
    transform: translateY(-50%) scale(1.3) rotate(10deg);
    opacity: 1;
  }
  100% {
    transform: translateY(-50%) scale(1) rotate(0deg);
    opacity: 1;
  }
}

@keyframes wrongShakeHard {
  0%, 100% { transform: translateX(0) rotate(0deg); }
  10% { transform: translateX(-12px) rotate(-3deg); }
  20% { transform: translateX(12px) rotate(3deg); }
  30% { transform: translateX(-10px) rotate(-2deg); }
  40% { transform: translateX(10px) rotate(2deg); }
  50% { transform: translateX(-8px) rotate(-1deg); }
  60% { transform: translateX(8px) rotate(1deg); }
  70% { transform: translateX(-5px) rotate(-0.5deg); }
  80% { transform: translateX(5px) rotate(0.5deg); }
  90% { transform: translateX(-2px) rotate(0deg); }
}

@keyframes crossShake {
  0%, 100% { transform: translateY(-50%) rotate(0deg); opacity: 1; }
  25% { transform: translateY(-50%) rotate(-15deg); }
  75% { transform: translateY(-50%) rotate(15deg); }
}

/* ─── 단답형 입력 ─── */
.short-input-wrap {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.short-input {
  flex: 1;
  min-width: 0;
  padding: 14px 16px;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 1.05rem;
  outline: none;
  transition: border-color 0.2s;
}

.short-input:focus { border-color: var(--duo-green); }

.submit-btn {
  padding: 14px 20px;
  background: var(--duo-green);
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  white-space: nowrap;
  flex-shrink: 0;
}

.submit-btn:hover:not(:disabled) { background: var(--duo-green2); }
.submit-btn:active:not(:disabled) { transform: scale(0.97); }
.submit-btn:disabled { opacity: 0.5; cursor: default; }

/* ─── 피드백 ─── */
.feedback {
  display: none;
  margin-top: 16px;
  animation: fadeIn 0.2s ease;
}

.fb-correct {
  background: var(--green-bg);
  border: 2px solid var(--duo-green);
  border-radius: var(--radius-sm);
  padding: 16px;
  color: var(--duo-green);
  font-size: 1.05rem;
  font-weight: 700;
  animation: fbSlideIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.fb-wrong {
  background: var(--red-bg);
  border: 2px solid var(--red);
  border-radius: var(--radius-sm);
  padding: 16px;
  color: var(--red);
  font-size: 1.05rem;
  font-weight: 700;
  animation: fbSlideIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), fbWrongShake 0.4s 0.15s ease;
}
@keyframes fbSlideIn {
  0% { transform: translateY(15px) scale(0.9); opacity: 0; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}
@keyframes fbWrongShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

.fb-icon { 
  font-size: 1.3rem; 
  margin-right: 6px;
  display: inline-block;
  animation: iconPopBig 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes iconPopBig {
  0% {
    transform: scale(0) rotate(-180deg);
    opacity: 0;
  }
  50% {
    transform: scale(1.5) rotate(20deg);
  }
  70% {
    transform: scale(0.9) rotate(-10deg);
  }
  85% {
    transform: scale(1.1) rotate(5deg);
  }
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

/* 정답 피드백 애니메이션 */
.fb-correct {
  animation: feedbackSlideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), feedbackGlow 0.6s ease-in-out;
}

.fb-correct .fb-icon {
  animation: correctIconSpin 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes correctIconSpin {
  0% {
    transform: scale(0) rotate(0deg);
    opacity: 0;
    filter: hue-rotate(0deg);
  }
  60% {
    transform: scale(1.6) rotate(360deg);
    opacity: 1;
  }
  80% {
    transform: scale(0.85) rotate(380deg);
    filter: hue-rotate(30deg);
  }
  100% {
    transform: scale(1) rotate(360deg);
    opacity: 1;
    filter: hue-rotate(0deg);
  }
}

@keyframes feedbackGlow {
  0%, 100% {
    box-shadow: 0 0 20px rgba(88, 204, 2, 0.3);
  }
  50% {
    box-shadow: 0 0 40px rgba(88, 204, 2, 0.6), 0 0 60px rgba(88, 204, 2, 0.3);
  }
}

/* 오답 피드백 애니메이션 */
.fb-wrong {
  animation: feedbackSlideUp 0.4s ease, feedbackPulse 0.5s ease;
}

.fb-wrong .fb-icon {
  animation: wrongIconDrop 0.7s ease;
}

@keyframes wrongIconDrop {
  0% {
    transform: translateY(-30px) scale(0) rotate(-45deg);
    opacity: 0;
  }
  60% {
    transform: translateY(5px) scale(1.3) rotate(10deg);
    opacity: 1;
  }
  80% {
    transform: translateY(-2px) scale(0.9) rotate(-5deg);
  }
  100% {
    transform: translateY(0) scale(1) rotate(0deg);
    opacity: 1;
  }
}

@keyframes feedbackPulse {
  0%, 100% {
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.3);
  }
  50% {
    box-shadow: 0 0 30px rgba(239, 68, 68, 0.5);
  }
}

.fb-next-btn {
  display: block;
  width: 100%;
  margin-top: 14px;
  padding: 12px;
  background: var(--red);
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}
.fb-next-btn:hover { background: #e04343; }
.fb-next-btn:active { transform: scale(0.97); }

.fb-answer {
  margin-top: 8px;
  font-size: 0.9rem;
  color: var(--text-dim);
  font-weight: 500;
}

.fb-solution {
  margin-top: 10px;
  font-size: 0.85rem;
  color: var(--text-dim);
  font-weight: 400;
  line-height: 1.6;
}
.fb-solution strong { color: var(--text); }

/* ═══════════════════════════════════════════════════════════
   완료 화면
   ═══════════════════════════════════════════════════════════ */
.complete-screen {
  text-align: center;
  padding: 40px 20px;
  animation: completeScreenFadeIn 0.6s ease;
}
.complete-screen.unit-complete-celebration {
  position: relative;
  overflow: visible;
}

@keyframes completeScreenFadeIn {
  0% {
    opacity: 0;
    transform: scale(0.9) translateY(30px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.complete-mascot {
  font-size: 3rem;
  margin-bottom: 8px;
  animation: mascotEntrance 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes mascotEntrance {
  0% {
    transform: scale(0) rotate(-180deg) translateY(-50px);
    opacity: 0;
  }
  60% {
    transform: scale(1.2) rotate(10deg) translateY(0);
  }
  80% {
    transform: scale(0.95) rotate(-5deg);
  }
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

.complete-mascot-img {
  width: 90px;
  height: 90px;
  object-fit: cover;
  object-position: 35% center;
  border-radius: 50%;
  margin-bottom: 8px;
  animation: mascotEntrance 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.3));
}

.complete-emoji {
  font-size: 4rem;
  margin-bottom: 16px;
  animation: trophyDrop 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  display: inline-block;
}

@keyframes trophyDrop {
  0% {
    transform: translateY(-100px) scale(0.3) rotate(-45deg);
    opacity: 0;
  }
  60% {
    transform: translateY(10px) scale(1.15) rotate(10deg);
    opacity: 1;
  }
  80% {
    transform: translateY(-5px) scale(0.95) rotate(-5deg);
  }
  100% {
    transform: translateY(0) scale(1) rotate(0deg);
    opacity: 1;
  }
}

.trophy-gold { 
  color: #FFD700; 
  text-shadow: 0 0 30px rgba(255,215,0,0.6), 0 0 60px rgba(255,215,0,0.3);
  animation: trophyDrop 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55), goldShine 2s ease-in-out infinite;
}

.trophy-silver { 
  color: #C0C0C0; 
  text-shadow: 0 0 25px rgba(192,192,192,0.5), 0 0 50px rgba(192,192,192,0.25);
  animation: trophyDrop 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55), silverShine 2s ease-in-out infinite;
}

.trophy-bronze { 
  color: #CD7F32; 
  text-shadow: 0 0 25px rgba(205,127,50,0.5), 0 0 50px rgba(205,127,50,0.25);
  animation: trophyDrop 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55), bronzeShine 2s ease-in-out infinite;
}

@keyframes goldShine {
  0%, 100% {
    filter: brightness(1) drop-shadow(0 0 10px rgba(255,215,0,0.3));
  }
  50% {
    filter: brightness(1.3) drop-shadow(0 0 20px rgba(255,215,0,0.6));
  }
}

@keyframes silverShine {
  0%, 100% {
    filter: brightness(1) drop-shadow(0 0 8px rgba(192,192,192,0.3));
  }
  50% {
    filter: brightness(1.2) drop-shadow(0 0 16px rgba(192,192,192,0.5));
  }
}

@keyframes bronzeShine {
  0%, 100% {
    filter: brightness(1) drop-shadow(0 0 8px rgba(205,127,50,0.3));
  }
  50% {
    filter: brightness(1.2) drop-shadow(0 0 16px rgba(205,127,50,0.5));
  }
}

.complete-screen h2 {
  font-size: 1.5rem;
  color: var(--duo-green);
  margin-bottom: 8px;
  font-weight: 800;
  animation: textSlideIn 0.6s 0.2s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

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

.complete-title {
  font-size: 1rem;
  color: var(--text-dim);
  margin-bottom: 4px;
  animation: textSlideIn 0.6s 0.3s ease both;
}

.complete-score {
  font-size: 1.1rem;
  color: var(--gold);
  font-weight: 700;
  margin-bottom: 28px;
}

.complete-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 300px;
  margin: 0 auto;
}

.action-btn {
  padding: 14px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.action-btn:active { transform: scale(0.98); }

.action-btn.next {
  background: var(--duo-green);
  color: #fff;
}
.action-btn.next:hover { background: var(--duo-green2); }

.action-btn.replay {
  background: var(--accent);
  color: #fff;
}
.action-btn.replay:hover { background: var(--accent2); }

.action-btn.home {
  background: var(--surface);
  border: 2px solid var(--border);
  color: var(--text);
}
.action-btn.home:hover { border-color: var(--duo-green); }

/* ═══════════════════════════════════════════════════════════
   레거시: 개별 문제 상세
   ═══════════════════════════════════════════════════════════ */
.detail {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 20px;
  box-shadow: var(--shadow-sm);
}

.detail h2 {
  color: var(--duo-green);
  font-size: 1.2rem;
  margin-bottom: 16px;
}

.detail .body-text {
  font-size: 1rem;
  line-height: 1.8;
  margin-bottom: 20px;
  padding: 16px;
  background: var(--bg);
  border-radius: var(--radius-sm);
}

.detail .answer-box {
  background: var(--green-bg);
  border: 2px solid var(--duo-green);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 16px;
}

.detail .answer-box .label {
  font-size: 0.8rem;
  color: var(--duo-green);
  font-weight: 700;
  margin-bottom: 4px;
  text-transform: uppercase;
}

.choice-item {
  padding: 10px 14px;
  margin-bottom: 6px;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
}

.choice-item.correct {
  background: var(--green-bg);
  border-color: var(--duo-green);
  color: var(--duo-green);
  font-weight: 700;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 2px solid var(--border);
  color: var(--duo-green);
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  margin-bottom: 16px;
  transition: all 0.2s;
}

.back-btn:hover {
  background: var(--surface2);
  border-color: var(--duo-green);
}

/* ─── 로딩 / 에러 ─── */
.loading {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
}

.loading .spinner {
  display: inline-block;
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--duo-green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 12px;
}

.error {
  text-align: center;
  padding: 40px 20px;
  color: var(--red);
}

/* ═══════════════════════════════════════════════════════════
   애니메이션
   ═══════════════════════════════════════════════════════════ */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

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

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

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

/* ═══ 정답/오답 애니메이션 키프레임 ═══ */
@keyframes correctBounce {
  0% { transform: scale(1); }
  25% { transform: scale(1.15) rotate(2deg); }
  50% { transform: scale(0.95) rotate(-1deg); }
  75% { transform: scale(1.05) rotate(1deg); }
  100% { transform: scale(1) rotate(0); }
}

@keyframes wrongShake {
  0%, 100% { transform: translateX(0) rotate(0); }
  10% { transform: translateX(-6px) rotate(-2deg); }
  20% { transform: translateX(6px) rotate(2deg); }
  30% { transform: translateX(-5px) rotate(-1deg); }
  40% { transform: translateX(5px) rotate(1deg); }
  50% { transform: translateX(-3px) rotate(-1deg); }
  60% { transform: translateX(3px) rotate(1deg); }
  70% { transform: translateX(-2px) rotate(0); }
  80% { transform: translateX(2px) rotate(0); }
}

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

@keyframes correctIconBurst {
  0% { transform: scale(0) rotate(-180deg); opacity: 0; }
  50% { transform: scale(1.5) rotate(180deg); opacity: 1; }
  70% { transform: scale(1.2) rotate(200deg); }
  100% { transform: scale(1) rotate(360deg); opacity: 1; }
}

@keyframes wrongIconShake {
  0% { transform: scale(0) rotate(0); opacity: 0; }
  20% { transform: scale(1.2) rotate(-15deg); opacity: 1; }
  40% { transform: scale(1.1) rotate(15deg); }
  60% { transform: scale(1.15) rotate(-10deg); }
  80% { transform: scale(1.05) rotate(5deg); }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

@keyframes feedbackSlideUp {
  0% { 
    transform: translateY(30px) scale(0.9); 
    opacity: 0; 
  }
  60% { 
    transform: translateY(-5px) scale(1.02); 
    opacity: 1; 
  }
  100% { 
    transform: translateY(0) scale(1); 
    opacity: 1; 
  }
}

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

@keyframes celebratePulse {
  0% { box-shadow: 0 0 0 0 rgba(88,204,2,0.4); }
  50% { box-shadow: 0 0 0 12px rgba(88,204,2,0); }
  100% { box-shadow: 0 0 0 0 rgba(88,204,2,0); }
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════════════════════════
   🎆 강력한 피드백 애니메이션
   ═══════════════════════════════════════════════════════════ */

/* 파티클 폭발 애니메이션 */
@keyframes particleBurstcorrect {
  0% {
    transform: translate(0, 0) rotate(0deg) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(var(--tx), var(--ty)) rotate(var(--rot)) scale(0.3);
    opacity: 0;
  }
}

@keyframes particleBurstwrong {
  0% {
    transform: translate(0, 0) rotate(0deg) scale(1);
    opacity: 1;
  }
  50% {
    opacity: 0.8;
  }
  100% {
    transform: translate(var(--tx), calc(var(--ty) * 1.5)) rotate(var(--rot)) scale(0.2);
    opacity: 0;
  }
}

/* 컨페티 떨어지기 */
@keyframes confettiFall {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(calc(100vh + 50px)) rotate(var(--rot));
    opacity: 0;
  }
}

/* 화면 플래시 효과 */
@keyframes screenFlash {
  0% {
    opacity: 0;
    transform: scale(0.8);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(1.2);
  }
}

/* 충격파 확장 */
@keyframes shockwaveExpand {
  0% {
    width: 20px;
    height: 20px;
    opacity: 1;
    border-width: 3px;
  }
  100% {
    width: 300px;
    height: 300px;
    opacity: 0;
    border-width: 0px;
  }
}

/* 카드 펀치 효과 (정답) */
@keyframes cardPunchIn {
  0% {
    transform: scale(1);
  }
  30% {
    transform: scale(1.05) rotate(2deg);
  }
  50% {
    transform: scale(0.98) rotate(-1deg);
  }
  70% {
    transform: scale(1.02) rotate(1deg);
  }
  100% {
    transform: scale(1) rotate(0deg);
  }
}

/* 카드 흔들기 (오답) */
@keyframes cardShakeWrong {
  0%, 100% { transform: translateX(0) rotate(0deg); }
  10% { transform: translateX(-10px) rotate(-2deg); }
  20% { transform: translateX(10px) rotate(2deg); }
  30% { transform: translateX(-10px) rotate(-1deg); }
  40% { transform: translateX(10px) rotate(1deg); }
  50% { transform: translateX(-8px) rotate(-1deg); }
  60% { transform: translateX(8px) rotate(1deg); }
  70% { transform: translateX(-5px) rotate(-0.5deg); }
  80% { transform: translateX(5px) rotate(0.5deg); }
  90% { transform: translateX(-3px) rotate(0deg); }
}

/* 텍스트 바운스 (정답) */
.fb-text-bounce {
  display: inline-block;
  animation: textBounce 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes textBounce {
  0% {
    transform: scale(0.3) translateY(20px);
    opacity: 0;
  }
  50% {
    transform: scale(1.2) translateY(-10px);
  }
  70% {
    transform: scale(0.9) translateY(5px);
  }
  100% {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

/* 텍스트 흔들기 (오답) */
.fb-text-shake {
  display: inline-block;
  animation: textShakeWrong 0.5s ease;
}

@keyframes textShakeWrong {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-8px); }
  20%, 40%, 60%, 80% { transform: translateX(8px); }
}

/* 향상된 피드백 아이콘 애니메이션 */
@keyframes correctIconBurst {
  0% {
    transform: scale(0) rotate(0deg);
    opacity: 0;
  }
  50% {
    transform: scale(1.5) rotate(180deg);
    opacity: 1;
  }
  70% {
    transform: scale(0.9) rotate(360deg);
  }
  100% {
    transform: scale(1) rotate(360deg);
    opacity: 1;
  }
}

@keyframes wrongIconShake {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  10%, 30%, 50%, 70%, 90% { transform: translateY(-5px) rotate(-10deg); }
  20%, 40%, 60%, 80% { transform: translateY(5px) rotate(10deg); }
}

/* 피드백 박스 강화 */
.fb-correct {
  position: relative;
  overflow: visible;
  box-shadow: 0 0 20px rgba(88, 204, 2, 0.3);
}

.fb-wrong {
  position: relative;
  overflow: visible;
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.3);
}

/* ═══════════════════════════════════════════════════════════
   돌보기 시스템 (Care Section)
   ═══════════════════════════════════════════════════════════ */
.care-section {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
  animation: fadeIn 0.4s ease;
}
.care-balance {
  text-align: center;
  font-size: 1.1rem;
  font-weight: 700;
  color: #f59e0b;
  margin-bottom: 14px;
  padding: 6px 14px;
  background: rgba(245,158,11,0.08);
  border-radius: 20px;
  display: inline-block;
  width: 100%;
  box-sizing: border-box;
}
/* ── needs 게이지 ── */
.care-needs {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}
.care-need-item {
  display: flex;
  align-items: center;
  gap: 10px;
}
.care-need-label {
  width: 80px;
  min-width: 80px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  flex-shrink: 0;
  white-space: nowrap;
}
.care-need-bar {
  flex: 1;
  height: 16px;
  background: var(--bg);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.care-need-fill {
  height: 100%;
  border-radius: 8px;
  transition: width 0.5s ease, background 0.3s ease;
}
.care-need-val {
  width: 38px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--sub);
  text-align: right;
  flex-shrink: 0;
}
/* ── 돌보기 버튼 (처음 작았다가 커지는 효과) ── */
.care-actions {
  display: flex;
  gap: 8px;
}
.care-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 6px;
  border: 2px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s, box-shadow 0.2s;
  position: relative;
  animation: careBtnGrow 0.5s ease-out forwards;
  transform-origin: center center;
}
.care-actions .care-btn:nth-child(1) { animation-delay: 0.1s; }
.care-actions .care-btn:nth-child(2) { animation-delay: 0.2s; }
.care-actions .care-btn:nth-child(3) { animation-delay: 0.3s; }
@keyframes careBtnGrow {
  0%   { opacity: 0; transform: scale(0.4); }
  70%  { opacity: 1; transform: scale(1.05); }
  100% { opacity: 1; transform: scale(1); }
}
.care-btn:hover {
  transform: translateY(-2px) scale(1);
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(88,204,2,0.2);
}
.care-btn:active {
  transform: scale(0.95);
}
.care-btn-icon {
  font-size: 1.6rem;
}
.care-btn-text {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text);
}
.care-btn-cost {
  font-size: 0.7rem;
  font-weight: 600;
  color: #f59e0b;
  background: rgba(245,158,11,0.1);
  padding: 2px 8px;
  border-radius: 10px;
}
.care-btn-feed:hover:not(:disabled) { border-color: #22c55e; }
.care-btn-clean:hover:not(:disabled) { border-color: #3b82f6; }
.care-btn-play:hover:not(:disabled) { border-color: #a855f7; }

/* 100% 도달 시 비활성화 */
.care-btn-maxed {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
  filter: grayscale(0.4);
}
.care-btn-maxed .care-btn-text {
  color: var(--text-dim);
}
.care-btn-maxed .care-btn-cost {
  display: none;
}

/* ══ 서식지 이펙트 (세분화) ══════════════════════════════ */

/* ── 바닥 오염 오버레이 ── */
.habitat-ground { position: absolute; transition: filter 0.4s ease; }
.habitat-ground::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  transition: opacity 0.4s ease, background 0.4s ease;
  opacity: 0;
}
.ground-dirty-1::after {
  background: repeating-conic-gradient(rgba(120,80,30,0.08) 0% 25%, transparent 0% 50%) 0 0/40px 40px;
  opacity: 1;
}
.ground-dirty-2::after {
  background: repeating-conic-gradient(rgba(100,65,20,0.13) 0% 25%, transparent 0% 50%) 0 0/32px 32px;
  opacity: 1;
}
.ground-dirty-2 { filter: brightness(0.88) saturate(0.8); }
.ground-dirty-3::after {
  background:
    radial-gradient(ellipse 40% 30% at 20% 50%, rgba(90,55,15,0.25) 0%, transparent 100%),
    radial-gradient(ellipse 35% 40% at 70% 40%, rgba(90,55,15,0.22) 0%, transparent 100%),
    repeating-conic-gradient(rgba(80,50,10,0.16) 0% 25%, transparent 0% 50%) 0 0/28px 28px;
  opacity: 1;
}
.ground-dirty-3 { filter: brightness(0.75) saturate(0.6); }

/* 서식지 전체 갈색 tint (매우 더러울 때) */
.habitat-tinted::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(80,50,10,0.12);
  z-index: 4;
  pointer-events: none;
  border-radius: inherit;
}

/* ── 똥 (바닥 고정) ── */
.poop-pile {
  position: absolute;
  font-size: 1.5rem;
  z-index: 3;
  pointer-events: none;
  animation: poopAppear 0.5s ease-out both;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
}
.poop-sm { font-size: 1.1rem; }
@keyframes poopAppear {
  0%   { opacity: 0; transform: scale(0) translateY(-30px); }
  40%  { opacity: 1; transform: scale(1.2) translateY(-5px); }
  60%  { transform: scale(0.9) translateY(2px); }
  80%  { transform: scale(1.05) translateY(-1px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

/* ── 개미 한 마리: 펫 근처에서 왔다갔다 ── */
.ant-near-pet {
  position: absolute;
  font-size: 1.1rem;
  left: 50%;
  bottom: 32%;
  z-index: 7;
  pointer-events: none;
  animation: antWalk 3s ease-in-out infinite;
  transform: translateX(-50%);
  line-height: 1;
}
@keyframes antWalk {
  0%, 100% { transform: translateX(-50%) translateX(-28px); }
  50%     { transform: translateX(-50%) translateX(28px); }
}

/* ── 응가 위로 연기 솟구침 (💨 90도 돌려서 위 향하고, 화면 기준 위로 이동) ── */
.stink-cloud {
  position: absolute;
  font-size: 1.5rem;
  z-index: 4;
  pointer-events: none;
  opacity: 0.6;
  animation: stinkRise 2.2s ease-out infinite;
  transform-origin: center bottom;
  display: inline-block;
  transform: rotate(-90deg);
}
/* 회전 -90deg 후: 요소 오른쪽(+)이 화면 위이므로 translateX(양수)로 위로 이동 */
@keyframes stinkRise {
  0%   { opacity: 0.2; transform: rotate(-90deg) translateX(0) scale(0.6); }
  40%  { opacity: 0.7; transform: rotate(-90deg) translateX(24px) scale(0.9); }
  100% { opacity: 0; transform: rotate(-90deg) translateX(56px) scale(1); }
}

/* ── 배고픔: 말풍선 ── */
.thought-bubble {
  position: absolute;
  top: 18%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.8rem;
  z-index: 6;
  pointer-events: none;
  animation: thoughtBounce 2s ease-in-out infinite;
}
@keyframes thoughtBounce {
  0%, 100% { transform: translateX(-50%) translateY(0) scale(1); }
  30%  { transform: translateX(-50%) translateY(-10px) scale(1.1); }
  60%  { transform: translateX(-50%) translateY(-4px) scale(1); }
}
.hunger-dizzy {
  position: absolute;
  top: 28%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.3rem;
  z-index: 6;
  pointer-events: none;
  animation: dizzyWobble 1.5s ease-in-out infinite;
}
@keyframes dizzyWobble {
  0%, 100% { transform: translateX(-50%) rotate(0deg); }
  25%  { transform: translateX(-50%) rotate(-8deg); }
  75%  { transform: translateX(-50%) rotate(8deg); }
}

/* ── 행복: 눈물 ── */
.tear-drop {
  position: absolute;
  top: 42%;
  left: calc(50% + var(--tear-x, 0px));
  width: 8px;
  height: 12px;
  background: rgba(100,180,255,0.7);
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  z-index: 6;
  pointer-events: none;
  animation: tearFall 1.2s ease-in infinite;
  animation-delay: var(--tear-d, 0s);
}
@keyframes tearFall {
  0%   { opacity: 1; transform: translateY(0) scale(1); }
  80%  { opacity: 0.6; transform: translateY(40px) scale(0.7); }
  100% { opacity: 0; transform: translateY(55px) scale(0.4); }
}

/* ── 행복: 먹구름 ── */
.dark-cloud {
  position: absolute;
  font-size: 2.2rem;
  z-index: 5;
  pointer-events: none;
  opacity: 0.6;
  filter: brightness(0.5) saturate(0);
  animation: cloudDrift 4s ease-in-out infinite;
}
@keyframes cloudDrift {
  0%, 100% { transform: translateX(0); opacity: 0.5; }
  50%  { transform: translateX(12px); opacity: 0.7; }
}

/* ── 좋은 상태: 하트 파티클 ── */
.love-particle {
  position: absolute;
  top: 20%;
  left: calc(50% + var(--lp-x, 0px));
  font-size: 1.3rem;
  z-index: 6;
  pointer-events: none;
  animation: loveRise 2s ease-out infinite;
  animation-delay: var(--lp-d, 0s);
}
@keyframes loveRise {
  0%   { opacity: 1; transform: translateY(0) scale(0.6); }
  50%  { opacity: 1; transform: translateY(-20px) scale(1.2); }
  100% { opacity: 0; transform: translateY(-40px) scale(0.8); }
}

/* ── 좋은 상태: 반짝이 ── */
.sparkle-particle {
  position: absolute;
  top: calc(35% + var(--sp-y, 0px));
  left: calc(50% + var(--sp-x, 0px));
  font-size: 1rem;
  z-index: 6;
  pointer-events: none;
  animation: sparklePop 1.5s ease-in-out infinite;
  animation-delay: var(--sp-d, 0s);
}
@keyframes sparklePop {
  0%, 100% { opacity: 0; transform: scale(0.3); }
  50%  { opacity: 1; transform: scale(1.2); }
}

/* 펫 시들기 (needs 평균 < 20) */
.pet-wilting {
  filter: saturate(0.3) brightness(0.7);
  animation: petWilt 2s ease-in-out infinite !important;
}
@keyframes petWilt {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(2px) rotate(-3deg); }
  75% { transform: translateY(2px) rotate(3deg); }
}

/* ── 돌보기 애니메이션 (떠오르는 이모지) ── */
.care-anim-float {
  position: absolute;
  font-size: 2.2rem;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: careFloatUp 1s ease-out forwards;
  z-index: 20;
  pointer-events: none;
}
@keyframes careFloatUp {
  0%   { opacity: 1; transform: translate(-50%, -50%) scale(0.5); }
  60%  { opacity: 1; transform: translate(-50%, -110%) scale(1.3); }
  100% { opacity: 0; transform: translate(-50%, -160%) scale(0.8); }
}

/* ── EXP 말풍선 (돌보기 시) ── */
.care-xp-float {
  position: absolute;
  top: 35%;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  animation: careXpRise 1.2s ease-out forwards;
  z-index: 25;
  pointer-events: none;
}
.care-xp-text {
  background: linear-gradient(135deg, #7c3aed, #a78bfa);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 800;
  padding: 4px 14px;
  border-radius: 20px;
  white-space: nowrap;
  box-shadow: 0 2px 10px rgba(124,58,237,0.4);
}
.care-effect-text {
  color: #22c55e;
  font-size: 0.78rem;
  font-weight: 700;
  text-shadow: 0 1px 3px rgba(0,0,0,0.3);
  white-space: nowrap;
}
@keyframes careXpRise {
  0%   { opacity: 0; transform: translateX(-50%) translateY(0) scale(0.6); }
  20%  { opacity: 1; transform: translateX(-50%) translateY(-10px) scale(1.1); }
  70%  { opacity: 1; transform: translateX(-50%) translateY(-50px) scale(1); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-80px) scale(0.8); }
}

/* ── 돌보기 버튼 설명 텍스트 ── */
.care-btn-desc {
  display: block;
  font-size: 0.65rem;
  color: rgba(255,255,255,0.7);
  margin-top: 2px;
  font-weight: 500;
}

/* ── 돌보기 팁 ── */
.care-tip {
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-top: 10px;
  padding: 8px 12px;
  background: rgba(124,58,237,0.06);
  border-radius: var(--radius-sm);
  border: 1px dashed rgba(124,58,237,0.2);
}

/* ── 꾸미기 상점 ── */
.pet-header-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.shop-btn {
  background: var(--surface);
  border: 2px solid var(--border);
  color: var(--text);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}
.shop-btn:hover {
  border-color: var(--accent);
  background: var(--surface2);
}

.shop-card {
  width: 90%;
  max-width: 420px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}
.shop-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.shop-tabs {
  display: flex;
  gap: 4px;
  background: rgba(0,0,0,0.2);
  border-radius: 12px;
  padding: 4px;
}
.shop-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  line-height: 1.25;
}
.shop-tab-l1 { display: block; }
.shop-tab-l2 { display: block; font-size: 0.75em; opacity: 0.95; }
.shop-tab:hover { color: var(--text); }
.shop-tab.active {
  background: var(--accent);
  color: white;
}
.shop-balance {
  font-size: 1rem;
  font-weight: 700;
  color: #f59e0b;
  background: rgba(245,158,11,0.1);
  padding: 4px 10px;
  border-radius: 12px;
}
.shop-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
  overflow-y: auto;
  padding: 4px;
  margin-bottom: 16px;
}
.shop-item {
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}
.shop-item.equipped {
  border-color: #22c55e;
  background: rgba(34,197,94,0.05);
}
.shop-item.shop-item-locked {
  filter: blur(3px) grayscale(0.4);
  opacity: 0.45;
  pointer-events: none;
  position: relative;
}
.shop-item.shop-item-locked .shop-item-price {
  filter: none;
  color: #a78bfa;
  font-weight: 700;
}
.shop-btn-action.btn-locked {
  background: #555 !important;
  color: #aaa !important;
  cursor: not-allowed;
}
.shop-premium-hint {
  grid-column: 1 / -1;
  text-align: center;
  font-size: 0.78rem;
  color: #a78bfa;
  padding: 8px;
  margin-top: 4px;
}
.shop-blur-wrap {
  grid-column: 1 / -1;
  margin-top: 8px;
  border-radius: 12px;
  overflow: hidden;
  height: 280px;
  min-height: 280px;
}
.shop-blur-wrap .premium-blur-overlay {
  padding: 24px 16px;
}
.shop-blur-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 10px;
}
.shop-blur-grid .shop-item {
  min-height: 120px;
  background: var(--surface2, #2a2a3a);
  border: 2px solid var(--border, #3a3a4a);
}
.shop-item-icon {
  font-size: 2rem;
}
.shop-section-title {
  grid-column: 1 / -1;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  margin: 12px 0 4px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border, #334155);
}
.shop-section-title:first-child {
  margin-top: 0;
}
.shop-monster-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  min-height: 40px;
  background: rgba(0,0,0,0.06);
  border-radius: 8px;
}
.shop-monster-thumb {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: 8px;
  display: block;
}
.shop-monster-buy-desc {
  grid-column: 1 / -1;
  font-size: 0.85rem;
  color: var(--sub, #94a3b8);
  margin: 0 0 12px;
  line-height: 1.65;
  letter-spacing: 0.02em;
}
.shop-monster-buy-note {
  display: block;
  color: var(--sub, #94a3b8);
  font-size: 0.85rem;
  line-height: 1.5;
}
.shop-monster-buy-basic {
  color: #a78bfa;
  font-weight: 800;
  font-size: 1em;
}
.shop-item-monster-buy .shop-item-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
}
.shop-monster-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-top: 4px;
}
.shop-monster-skill-btn,
.shop-monster-evo-btn {
  font-size: 0.75rem;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  cursor: pointer;
  white-space: nowrap;
}
.shop-monster-skill-btn {
  background: rgba(124,58,237,0.12);
  color: #a78bfa;
}
.shop-monster-skill-btn:hover {
  background: rgba(124,58,237,0.25);
  border-color: #7c3aed;
  color: #c4b5fd;
}
.shop-monster-evo-btn {
  background: rgba(34,197,94,0.12);
  color: #4ade80;
}
.shop-monster-evo-btn:hover {
  background: rgba(34,197,94,0.25);
  border-color: #22c55e;
  color: #86efac;
}
.shop-item-monster-buy.shop-item-locked {
  filter: none;
  opacity: 1;
  pointer-events: auto;
}
.shop-item-monster-buy.shop-item-locked .shop-item-price {
  color: var(--sub);
}
.shop-monster-start-lvl {
  font-size: 0.75rem;
  color: var(--sub, #94a3b8);
  margin-top: 2px;
  font-weight: 500;
}
.shop-item-info {
  text-align: center;
}
.shop-item-name {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 2px;
}
.shop-item-price {
  font-size: 0.8rem;
  color: var(--sub);
}
.shop-btn-action {
  width: 100%;
  padding: 6px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}
.btn-buy {
  background: #f59e0b;
  color: #fff;
}
.btn-buy:hover { background: #d97706; }
.btn-equipped {
  background: transparent;
  color: #22c55e;
  cursor: default;
}
.shop-btn-action:not(.btn-buy):not(.btn-equipped) {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
}
.shop-btn-action:not(.btn-buy):not(.btn-equipped):hover {
  background: var(--border);
}

/* 몬스터꾸미기 — 악세서리 위치 조절 */
.shop-acc-position-section {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border, #334155);
  grid-column: 1 / -1;
}
.shop-acc-position-title {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 4px;
  color: var(--text, #e2e8f0);
}
.shop-acc-position-hint {
  font-size: 0.78rem;
  color: var(--muted, #94a3b8);
  margin-bottom: 10px;
}
.shop-acc-preview-wrap {
  display: flex;
  justify-content: center;
  padding: 12px;
  background: rgba(15, 23, 42, 0.6);
  border-radius: 10px;
  margin-bottom: 10px;
  border: 1px solid var(--border, #334155);
}
.shop-acc-preview-inner {
  position: relative;
  font-size: 5rem;
  width: 120px;
  height: 120px;
}
.shop-acc-preview-img {
  width: 120px;
  height: 120px;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 8px 24px rgba(0,0,0,0.4));
}
.shop-acc-wrap {
  position: absolute;
  cursor: move;
  user-select: none;
  touch-action: none;
  line-height: 1;
  top: -0.4em;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
}
.shop-acc-wrap .shop-acc-handle {
  position: absolute;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 20px;
  text-align: center;
  user-select: none;
  pointer-events: auto;
}
.shop-acc-resize {
  right: -12px;
  bottom: -12px;
  background: #475569;
  color: #e2e8f0;
  border: 1px solid #64748b;
  cursor: nwse-resize;
}
.shop-acc-rotate {
  left: -14px;
  bottom: -12px;
  background: #6366f1;
  color: #e2e8f0;
  border: 1px solid #818cf8;
  cursor: grab;
}
.shop-acc-angle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.shop-acc-angle-label {
  font-size: 0.85rem;
  color: var(--muted, #94a3b8);
  white-space: nowrap;
}
.shop-acc-angle-slider {
  flex: 1;
  accent-color: #6366f1;
}
.shop-acc-angle-display {
  font-size: 0.85rem;
  color: var(--text, #e2e8f0);
  min-width: 36px;
  text-align: right;
}
.shop-acc-save-btn {
  width: 100%;
  padding: 10px 14px;
  font-size: 0.95rem;
  background: #22c55e;
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}
.shop-acc-save-btn:disabled {
  opacity: 0.8;
  cursor: default;
}

/* 아바타 꾸미기 — 악세서리 위치 조절 */
.avatar-acc-position-section {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border, #334155);
}
.avatar-acc-position-title {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 4px;
  color: var(--text, #e2e8f0);
}
.avatar-acc-position-hint {
  font-size: 0.78rem;
  color: var(--muted, #94a3b8);
  margin-bottom: 10px;
}
.avatar-acc-preview-wrap {
  display: flex;
  justify-content: center;
  padding: 12px;
  background: rgba(15, 23, 42, 0.6);
  border-radius: 10px;
  margin-bottom: 10px;
  border: 1px solid var(--border, #334155);
}
.avatar-acc-preview-inner {
  position: relative;
  width: 100px;
  height: 100px;
  font-size: 55px;
}
.avatar-acc-head {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  z-index: 1;
}
.avatar-acc-wrap {
  position: absolute;
  cursor: move;
  user-select: none;
  touch-action: none;
  line-height: 1;
  z-index: 2;
}
.avatar-acc-wrap .shop-acc-handle {
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
  user-select: none;
  pointer-events: auto;
}

/* 꾸미기 상점 모바일 최적화 */
@media (max-width: 600px) {
  .shop-card {
    max-width: 96vw;
    max-height: 92vh;
    padding: 12px;
  }
  .shop-header {
    margin-bottom: 10px;
  }
  .shop-header .modal-title {
    font-size: 1rem;
  }
  .shop-balance {
    font-size: 0.8rem;
    padding: 3px 8px;
  }
  .shop-list {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 10px;
    flex: 1;
    min-height: 0;
  }
  .shop-item {
    padding: 8px 6px;
    gap: 4px;
  }
  .shop-item-icon {
    font-size: 1.4rem;
  }
  .shop-item-name {
    font-size: 0.72rem;
    margin-bottom: 0;
  }
  .shop-item-desc {
    font-size: 0.58rem;
    margin-top: 1px;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .shop-item-price {
    font-size: 0.68rem;
  }
  .shop-btn-action {
    padding: 4px 6px;
    font-size: 0.7rem;
  }
  .shop-card .modal-btn-secondary {
    padding: 8px 12px;
    font-size: 0.85rem;
  }
}

/* ── 토스트 (별 부족 경고) ── */
.care-toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: #fff;
  padding: 12px 22px;
  border-radius: 24px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  z-index: 9999;
  animation: toastIn 0.3s ease;
  white-space: nowrap;
}
.care-toast-hide {
  opacity: 0;
  transform: translateX(-50%) translateY(10px);
  transition: all 0.3s ease;
}
@keyframes toastIn {
  0% { opacity: 0; transform: translateX(-50%) translateY(20px); }
  100% { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── 홈 펫 카드 경고 상태 ── */
.pet-card-warn {
  border-color: #ef4444 !important;
  animation: petWarnPulse 1.5s ease-in-out infinite;
}
@keyframes petWarnPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0); }
  50% { box-shadow: 0 0 0 6px rgba(239,68,68,0.15); }
}
.pet-status-happy {
  color: #16a34a;
  font-weight: 700;
}
.pet-warn-text {
  color: #ef4444;
  font-size: 0.82rem;
  font-weight: 700;
  animation: fadeIn 0.3s ease;
}

/* ═══════════════════════════════════════════════════════════
   반응형
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
  .header { padding: 12px 16px; }
  .container { padding: 14px 12px; }
  .hero { padding: 18px 14px; gap: 12px; }
  .hero-mascot { width: 52px; height: 52px; font-size: 2.4rem; }
  .hero-mascot-img { width: 56px; height: 56px; }
  .hero-greeting { font-size: 1.15rem; }
  .dashboard { gap: 8px; }
  .dash-item { padding: 12px 6px; }
  .dash-value { font-size: 1.3rem; }
  .course-card { padding: 16px 14px; }
  .course-icon-wrap { width: 48px; height: 48px; }
  .course-icon { font-size: 1.5rem; }
  .play-card { padding: 18px 14px; max-width: 100%; overflow: hidden; }
  .play-stem { padding: 12px; font-size: 1rem; word-break: break-word; }
  .choice-btn { padding: 12px 14px; }
  .short-input { padding: 12px 10px; font-size: 0.95rem; }
  .submit-btn { padding: 12px 14px; font-size: 0.9rem; }
  .stage-card { padding: 14px 12px; }
  .complete-screen { padding: 30px 16px; }
  .detail { padding: 18px 14px; }
  .modal-select { font-size: 0.95rem; padding: 12px 14px; }
  .grade-up-banner { font-size: 0.85rem; padding: 12px 14px; }
  .path-circle { width: 48px; height: 48px; font-size: 1rem; }
  .unit-circle { width: 68px; height: 68px; font-size: 1.7rem; }
  .unit-active .unit-circle { width: 82px; height: 82px; font-size: 2rem; }
  .path-title { font-size: 0.85rem; }
  .pet-emoji { font-size: 2.2rem; width: 48px; height: 48px; }
  .pet-card { padding: 12px 14px; }
  .pet-options { gap: 4px; }
  .pet-option { padding: 6px 4px; }
  .pet-option-emoji { font-size: 1.4rem; }
  .pet-habitat { height: 296px; padding-top: 12px; }
  .pet-habitat .habitat-sky { transform: scale(0.76); transform-origin: 50% 0; }
  .habitat-pet { font-size: 3.5rem; }
  .pet-info-name { font-size: 1.1rem; }
  .pet-stats { gap: 6px; }
  .pet-stat { padding: 10px 6px; }
  .evo-emoji { font-size: 1.2rem; }
  .care-section { padding: 14px; }
  .care-need-label { width: 64px; min-width: 64px; font-size: 0.78rem; white-space: nowrap; }
  .care-need-bar { height: 14px; }
  .care-btn { padding: 10px 4px; }
  .care-btn-icon { font-size: 1.3rem; }
  .care-btn-text { font-size: 0.72rem; }
  .care-btn-cost { font-size: 0.65rem; }
  .poop-pile { font-size: 1.2rem; }
  .poop-sm { font-size: 0.9rem; }
  .ant-near-pet { font-size: 1rem; }
  .stink-cloud { font-size: 1.2rem; }
  .thought-bubble { font-size: 1.4rem; }
  .dark-cloud { font-size: 1.6rem; }
  .love-particle { font-size: 1.1rem; }
}

/* ═══════════════════════════════════════════════════════════
   학부모 대시보드
   ═══════════════════════════════════════════════════════════ */
.parent-dashboard {
  width: 94%;
  max-width: min(520px, 96vw);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  min-width: 0;
}

.parent-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 22px 10px;
}

.parent-header .modal-title { margin: 0; }

.parent-close-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--sub);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.parent-close-btn:hover { background: var(--danger); color: #fff; }

/* 학년별 기록 선택 */
.parent-grade-select-wrap {
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.parent-grade-select-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}
.parent-grade-select {
  min-width: 140px;
  padding: 8px 12px;
  font-size: 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
}

.parent-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  min-width: 0;
  padding: 10px 22px 20px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* 학부모 대시보드 내부 콘텐츠 가로 넘침 방지 */
.parent-content > * {
  max-width: 100%;
  box-sizing: border-box;
}

/* 하위 블록도 모두 제한 (premium-blur 내부, achievement 등) */
.parent-content .premium-blur-wrap,
.parent-content .premium-blur-content,
.parent-content .parent-ranked-history,
.parent-content .parent-ranked-summary,
.parent-content .parent-courses,
.parent-content .achievement-overview,
.parent-content .achievement-bar-chart,
.parent-content .achievement-compare-chart,
.parent-content .achievement-table-wrap,
.parent-content .achievement-weak-list,
.parent-content .growth-chart {
  max-width: 100%;
}

.parent-footer {
  display: flex;
  gap: 8px;
  padding: 12px 22px 18px;
  border-top: 1px solid var(--border);
}
.parent-footer .modal-btn-secondary { flex: 1; }

/* ── 위험 구역 (데이터 초기화) ── */
.parent-danger-zone {
  padding: 8px 22px 14px;
  text-align: center;
}
.parent-reset-btn {
  width: 100%;
  padding: 10px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #999;
  background: transparent;
  border: 1px dashed #ccc;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}
.parent-reset-btn:hover {
  color: #F44336;
  border-color: #F44336;
  background: rgba(244, 67, 54, 0.05);
}

/* ── 요약 카드 ── */
.parent-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.parent-summary-item {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 8px;
  text-align: center;
  min-width: 0;
}

.parent-summary-icon { font-size: 1.4rem; margin-bottom: 4px; }
.parent-summary-val { font-size: 1.3rem; font-weight: 800; color: var(--text); }
.parent-summary-label { font-size: 0.72rem; color: var(--sub); margin-top: 2px; }

/* ── 섹션 타이틀 ── */
.parent-section-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  margin: 18px 0 10px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--duo-green);
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 전체 사용자 통계 (100명 이상, N명 포맷) */
.parent-stats-placeholder { margin: 12px 0 16px; }
.parent-stats-note { font-size: 0.75rem; font-weight: 400; color: var(--sub); }
.parent-stats-loading,
.parent-stats-empty { font-size: 0.85rem; color: var(--sub); padding: 10px 0; }
.parent-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  margin-top: 8px;
}
.parent-stats-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  text-align: center;
}
.parent-stats-course { font-size: 0.8rem; font-weight: 600; color: var(--text); margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.parent-stats-label { font-size: 0.72rem; color: var(--sub); }
.parent-stats-rate { font-size: 1rem; font-weight: 700; color: var(--duo-green); margin-top: 4px; }

/* 학부모 대시보드: 기본 유저 시 프리미엄 전용 섹션 블러 모자이크 */
.premium-blur-wrap {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  margin-bottom: 16px;
  max-width: 100%;
  min-width: 0;
}
.premium-blur-content {
  filter: blur(6px);
  -webkit-filter: blur(6px);
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  opacity: 0.7;
}
.premium-blur-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.25);
  z-index: 5;
  gap: 8px;
}
.premium-blur-overlay .premium-lock-icon {
  font-size: 2rem;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.4));
}
.premium-blur-overlay .premium-lock-label {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #7c3aed, #6d28d9);
  padding: 8px 20px;
  border-radius: 999px;
  box-shadow: 0 2px 12px rgba(124,58,237,0.5);
  letter-spacing: 0.02em;
}
.premium-blur-overlay .premium-lock-sub {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.8);
  text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}

/* ── 코스별 진도 (간결) ── */
.parent-courses {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.parent-course-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-rows: auto auto;
  gap: 2px 10px;
  align-items: center;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  min-width: 0;
}

.parent-course-icon {
  font-size: 1.2rem;
  grid-row: 1 / 3;
  align-self: center;
}

.parent-course-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.parent-course-meta {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-align: right;
}

.parent-course-bar {
  grid-column: 2 / 4;
  height: 4px;
  background: var(--surface);
  border-radius: 2px;
  overflow: hidden;
}

.parent-course-fill {
  height: 100%;
  background: var(--duo-green);
  border-radius: 2px;
  transition: width 0.3s ease;
}

/* ── 최근 학습 기록 ── */
.parent-history {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.parent-history-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--surface2);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
}

.parent-history-date {
  color: var(--sub);
  font-weight: 600;
  font-size: 0.72rem;
  white-space: nowrap;
}

.parent-history-info {
  flex: 1;
  min-width: 0;
  display: flex;
  gap: 6px;
  align-items: center;
}

.parent-history-course {
  font-weight: 700;
  color: var(--text);
}

.parent-history-stage {
  color: var(--sub);
  font-size: 0.72rem;
}

.parent-history-stars {
  flex-shrink: 0;
  font-size: 0.8rem;
}

/* ── 펫 상태 ── */
.parent-pet-info {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 0.82rem;
  color: var(--sub);
}
.parent-pet-name { font-weight: 700; color: var(--text); }

/* ── PIN 입력 ── */
.pin-input {
  text-align: center;
  letter-spacing: 12px;
  font-size: 1.5rem;
  font-weight: 800;
}

.pin-error {
  color: var(--danger);
  font-size: 0.82rem;
  text-align: center;
  margin: -4px 0 8px;
  font-weight: 600;
}

/* 모바일 대응 */
@media (max-width: 480px) {
  .parent-dashboard { width: 98%; max-height: 92vh; }
  .ai-analysis-modal-card { width: 98%; max-width: 96vw; max-height: 95vh; }
  .parent-summary { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .parent-summary-item { padding: 10px 4px; }
  .parent-summary-val { font-size: 1.1rem; }
  .parent-summary-icon { font-size: 1.2rem; }
  .parent-content { padding: 10px 14px 16px; }
  .parent-ranked-row { grid-template-columns: 48px minmax(0, 1fr) 52px 66px; gap: 4px; font-size: 0.74rem; }
  .parent-ranked-history--ox .parent-ranked-row { grid-template-columns: 48px 1fr 60px; gap: 4px; }
  .achievement-overview { padding: 14px 12px; }
  .achievement-stat-card { padding: 10px 6px; }
  .stat-card-value { font-size: 1.2rem; }
  .stat-card-label { font-size: 0.7rem; }
  .chart-bar-label { width: 72px; max-width: 72px; font-size: 0.7rem; }
  .compare-label { width: 72px; max-width: 72px; font-size: 0.7rem; }
  .achievement-bar-chart,
  .achievement-compare-chart { padding: 12px 10px; }
  .acc-label-mobile-hide { display: none; }
  .achievement-table { font-size: 0.72rem; }
  .achievement-table th,
  .achievement-table td { padding: 6px 4px; }
  .achievement-level-legend { font-size: 0.68rem; }
}

/* ═══════════════════════════════════════════════════════════
   아바타 시스템
   ═══════════════════════════════════════════════════════════ */

/* ── 아바타 렌더링 ── */
.avatar {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

.av-head {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 2;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.av-eyes {
  display: flex;
  gap: 8px;
  line-height: 1;
  color: #1a1a1a;
}
.av-eye-l, .av-eye-r { display: inline-block; }

.av-mouth {
  line-height: 1;
  margin-top: 2px;
  color: #1a1a1a;
}

.av-hat {
  position: absolute;
  top: -30%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.2));
  line-height: 1;
}

.av-accessory {
  position: absolute;
  top: 32%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  opacity: 0.9;
  line-height: 1;
}

/* 마스크 악세사리 – 입/코 부분에 마스크만 표시 */
.av-accessory.av-mask {
  top: 52%;
  background: #e8f0fe;
  border-radius: 0 0 40% 40% / 0 0 60% 60%;
  border: 1.5px solid #b0c4de;
  opacity: 0.95;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.av-accessory.av-mask::before {
  content: '';
  position: absolute;
  top: 30%;
  left: 50%;
  transform: translateX(-50%);
  width: 50%;
  height: 1px;
  background: #b0c4de;
  opacity: 0.5;
}
.av-accessory.av-mask::after {
  content: '';
  position: absolute;
  top: 55%;
  left: 50%;
  transform: translateX(-50%);
  width: 45%;
  height: 1px;
  background: #b0c4de;
  opacity: 0.4;
}

/* 머리카락 */
.av-hair {
  position: absolute;
  z-index: 3;
  pointer-events: none;
}
/* 짧은머리: 이마~정수리 + 양옆 살짝 */
.av-hair-short {
  top: -18%; left: 5%; right: 5%;
  height: 42%;
  border-radius: 50% 50% 8% 8%;
}
/* 긴머리: 위에서 얼굴 옆으로 내려오되 눈/입은 안 가림 */
.av-hair-long {
  top: -16%; left: -2%; right: -2%;
  height: 55%;
  border-radius: 48% 48% 20% 20%;
}
.av-hair-long::before,
.av-hair-long::after {
  content: '';
  position: absolute;
  bottom: -60%;
  width: 22%;
  height: 70%;
  background: inherit;
  border-radius: 0 0 40% 40%;
}
.av-hair-long::before { left: 0; }
.av-hair-long::after { right: 0; }
/* 곱슬: 볼륨감 있게 */
.av-hair-curly {
  top: -22%; left: -6%; right: -6%;
  height: 52%;
  border-radius: 50% 50% 20% 20%;
}
.av-hair-curly::before,
.av-hair-curly::after {
  content: '';
  position: absolute;
  bottom: -30%;
  width: 18%;
  height: 45%;
  background: inherit;
  border-radius: 50%;
}
.av-hair-curly::before { left: 2%; }
.av-hair-curly::after { right: 2%; }
/* 묶은머리: 짧은 윗부분 + 오른쪽 포니테일 */
.av-hair-ponytail {
  top: -18%; left: 5%; right: 5%;
  height: 42%;
  border-radius: 50% 50% 8% 8%;
}
.av-hair-ponytail::after {
  content: '';
  position: absolute;
  right: -25%; top: 40%;
  width: 28%; height: 75%;
  background: inherit;
  border-radius: 0 60% 60% 20%;
}

.av-body {
  border-radius: 14px 14px 6px 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  margin-top: -2px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
.av-clothes-icon { opacity: 0.85; filter: drop-shadow(0 1px 1px rgba(0,0,0,0.15)); }

/* ── 아바타 히어로 ── */
.hero-avatar {
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.2s;
}
.hero-avatar:hover { transform: scale(1.08); }

/* ── 설정 모달 꾸미기 ── */
.settings-modal-card {
  max-width: 380px;
  max-height: min(90vh, calc(100vh - 40px));
  padding: 0;
  overflow-x: hidden;
  overflow-y: auto;
  text-align: left;
  -webkit-overflow-scrolling: touch;
  border-radius: 20px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.12);
}
@media (max-width: 480px) {
  #settingsModal.modal-overlay { align-items: flex-start; padding: 12px 10px 24px; }
  .settings-modal-card { margin: auto 0; }
}

.settings-header {
  background: linear-gradient(180deg, rgba(88, 204, 2, 0.08) 0%, transparent 100%);
  padding: 22px 28px 18px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}

.settings-avatar-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
}

.settings-avatar-wrap > div {
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  border: 3px solid var(--duo-green);
}

.settings-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text);
  margin: 0;
  letter-spacing: -0.02em;
}

.settings-section {
  padding: 18px 28px 20px;
  border-bottom: 1px solid var(--border);
}

.settings-section:last-of-type {
  border-bottom: none;
}

.settings-section-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: 0.02em;
  margin: 0 0 10px 0;
}

.settings-current {
  font-size: 0.95rem;
  color: var(--text);
  margin: 0 0 10px 0;
}

.settings-current strong {
  color: var(--duo-green);
  font-weight: 700;
}

/* 나의 현재 플랜 카드 (설정 상단) */
.settings-current-plan-section {
  padding: 20px 24px;
  margin: 0 0 24px 0;
  border-radius: 20px;
  border: 1px solid transparent;
  position: relative;
  overflow: hidden;
  background: var(--surface2);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}
.settings-current-plan-section.settings-plan-basic {
  border-color: rgba(34, 197, 94, 0.2);
}
.settings-current-plan-section.settings-plan-premium {
  border-color: rgba(234, 179, 8, 0.25);
}
.settings-current-plan-section.settings-plan-max {
  border-color: rgba(168, 85, 247, 0.25);
}
.settings-current-plan-section::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.1;
  pointer-events: none;
}
.settings-current-plan-section.settings-plan-basic::before {
  background: linear-gradient(145deg, #22c55e 0%, #16a34a 50%, transparent 100%);
}
.settings-current-plan-section.settings-plan-premium::before {
  background: linear-gradient(145deg, #eab308 0%, #ca8a04 50%, transparent 100%);
}
.settings-current-plan-section.settings-plan-max::before {
  background: linear-gradient(145deg, #a855f7 0%, #7c3aed 50%, transparent 100%);
}
.settings-plan-header-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.settings-plan-header-row .settings-plan-label {
  margin-bottom: 0;
}
.settings-plan-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 10px;
  letter-spacing: 0.02em;
}
.settings-plan-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  position: relative;
  z-index: 1;
}
.settings-plan-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.settings-current-plan-badge {
  display: inline-block;
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 8px 16px;
  border-radius: 12px;
  line-height: 1.3;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}
.settings-current-plan-badge.settings-plan-basic {
  background: linear-gradient(145deg, #22c55e 0%, #16a34a 100%);
  color: #fff;
  box-shadow: 0 2px 14px rgba(34, 197, 94, 0.4);
}
.settings-current-plan-badge.settings-plan-premium {
  background: linear-gradient(145deg, #eab308 0%, #ca8a04 100%);
  color: #fff;
  box-shadow: 0 2px 14px rgba(234, 179, 8, 0.4);
}
.settings-current-plan-badge.settings-plan-max {
  background: linear-gradient(145deg, #a855f7 0%, #7c3aed 100%);
  color: #fff;
  box-shadow: 0 2px 14px rgba(168, 85, 247, 0.4);
}
.settings-plan-status {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-dim);
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.06);
}
.settings-current-plan-section.settings-plan-premium .settings-plan-status,
.settings-current-plan-section.settings-plan-max .settings-plan-status {
  color: var(--text);
  background: rgba(255, 255, 255, 0.25);
}
.settings-plan-compare-link {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-dim);
  cursor: pointer;
  text-decoration: none;
  transition: color 0.2s;
  margin: 0;
}
.settings-plan-compare-link:hover {
  color: var(--accent);
}
.settings-plan-compare-link:active {
  opacity: 0.8;
}

.settings-row-btn {
  width: 100%;
  padding: 12px 16px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 8px;
  text-align: center;
}

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

.settings-row-btn:hover {
  border-color: var(--duo-green);
  color: var(--duo-green);
  background: rgba(88, 204, 2, 0.08);
}

.settings-row-btn.profile-switch-btn {
  margin-bottom: 0;
}

.settings-row-btn-secondary {
  margin-top: 6px;
  background: transparent;
  border: 1px solid var(--border-color, #ddd);
}

.settings-row-btn-secondary:hover {
  border-color: var(--text-dim);
  color: inherit;
  background: rgba(0, 0, 0, 0.04);
}

.settings-label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 6px;
  font-weight: 600;
}

.settings-test-tier-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  margin-top: 8px;
  margin-bottom: 4px;
}
.settings-radio-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  color: var(--text);
  cursor: pointer;
}
.settings-radio-label input { cursor: pointer; }

.settings-input,
.settings-select {
  margin-bottom: 14px;
}

.settings-av-edit {
  width: 100%;
  margin-bottom: 16px;
  padding: 8px 14px;
  font-size: 1.1rem;
}

.settings-save-btn {
  margin-top: 4px;
  margin-bottom: 0;
}

.settings-section-actions .settings-row-btn {
  margin-bottom: 8px;
}
.settings-section-alarm .settings-alarm-main-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0;
  cursor: pointer;
}
.settings-section-alarm .settings-alarm-main-row:active { opacity: 0.9; }

/* 슬라이드 토글 (알람) */
.alarm-slide-wrap {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 28px;
  flex-shrink: 0;
  cursor: pointer;
}
.alarm-slide-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.alarm-slide-track {
  position: absolute;
  inset: 0;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: background 0.2s, border-color 0.2s;
}
.alarm-slide-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  background: var(--text);
  border-radius: 50%;
  transition: transform 0.2s ease;
}
.alarm-slide-input:checked + .alarm-slide-track {
  background: var(--duo-green);
  border-color: var(--duo-green);
}
.alarm-slide-input:checked + .alarm-slide-track::after {
  transform: translateX(24px);
}

/* 알람 설정 전용 모달 */
.alarm-settings-modal .alarm-settings-card {
  max-width: 360px;
  width: 90%;
}
.alarm-settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.alarm-settings-title { font-size: 1.1rem; margin: 0; color: var(--text); }
.alarm-settings-close {
  width: 36px;
  height: 36px;
  border: none;
  background: var(--surface2);
  color: var(--sub);
  font-size: 1.5rem;
  line-height: 1;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.alarm-settings-close:hover { background: var(--surface); color: var(--text); }
.alarm-settings-body { margin-bottom: 20px; }
.alarm-slide-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.alarm-slide-row:last-of-type { border-bottom: none; }
.alarm-slide-label { font-size: 0.95rem; color: var(--text); }
.alarm-slide-sub {
  padding: 8px 0 12px 0;
  padding-left: 4px;
}
.alarm-slide-sublabel {
  display: block;
  font-size: 0.8rem;
  color: var(--sub);
  margin-bottom: 6px;
}
.alarm-settings-done { width: 100%; margin-top: 8px; }

.settings-section-actions .settings-label {
  margin-top: 12px;
  margin-bottom: 4px;
}
.settings-section-actions .settings-select {
  margin-bottom: 8px;
}
.settings-invite-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0;
  margin: 0;
  border: none;
  background: none;
  cursor: pointer;
  text-align: left;
  font-size: inherit;
  color: var(--text);
}
.settings-invite-toggle .settings-section-title {
  margin: 0;
}
.settings-invite-chevron {
  font-size: 0.75rem;
  color: var(--text-dim);
  transition: transform 0.2s ease;
}
.settings-section-invite.open .settings-invite-chevron {
  transform: rotate(90deg);
}
.settings-invite-content.settings-invite-collapsed {
  display: none;
}
.settings-invite-content:not(.settings-invite-collapsed) {
  padding-top: 14px;
}
.settings-invite-content .invite-code-box,
.settings-invite-content .invite-count {
  margin-bottom: 8px;
}

.settings-section-actions .settings-cancel {
  background: transparent;
  color: var(--text-dim);
}

.settings-section-actions .settings-cancel:hover {
  border-color: var(--text-dim);
  color: var(--text);
  background: var(--surface2);
}

.sync-user-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.sync-login-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 6px 0 !important;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--success, #22c55e);
}
.sync-login-badge-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success, #22c55e);
  animation: sync-badge-pulse 2s ease-in-out infinite;
}
@keyframes sync-badge-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}
.sync-user-email {
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.sync-signout-btn {
  flex-shrink: 0;
  width: auto !important;
  padding: 6px 12px !important;
  font-size: 0.8rem !important;
  color: var(--text-dim) !important;
}
.sync-google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #4285f4 !important;
  color: #fff !important;
  border: none !important;
  font-weight: 700;
}
.sync-google-g-icon {
  width: 18px;
  height: 18px;
  margin-right: 8px;
  flex-shrink: 0;
  background: #fff;
  padding: 4px;
  border-radius: 4px;
  box-sizing: content-box;
}
.sync-google-btn:hover {
  background: #3367d6 !important;
  color: #fff !important;
}

.settings-section-danger {
  padding-top: 16px;
  padding-bottom: 24px;
  background: rgba(255, 75, 75, 0.04);
}

.settings-reset-btn {
  margin: 0;
}

.av-edit-btn {
  background: transparent;
  border: 1px dashed var(--border);
  color: var(--text-dim);
  font-size: 0.78rem;
  padding: 4px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin-bottom: 10px;
  transition: all 0.2s;
}
.av-edit-btn:hover {
  border-color: var(--duo-green);
  color: var(--duo-green);
}

/* ── 아바타 생성기 카드 ── */
.avatar-creator-card {
  max-height: 88vh;
  overflow-y: auto;
}

.av-preview {
  display: flex;
  justify-content: center;
  padding: 16px 0;
  background: var(--surface2);
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
}

.av-editor {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.av-cat-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--sub);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.av-cat-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.av-opt-btn {
  min-width: 40px;
  height: 40px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  padding: 4px 8px;
}
.av-opt-btn:hover {
  border-color: var(--duo-green);
  transform: scale(1.05);
}

.av-opt-selected {
  border-color: var(--duo-green);
  background: rgba(88, 204, 2, 0.15);
  box-shadow: 0 0 0 2px rgba(88, 204, 2, 0.3);
}
.av-opt-locked {
  position: relative;
  filter: blur(3px) grayscale(0.5);
  opacity: 0.5;
  pointer-events: auto;
}
.av-opt-locked .av-lock-badge {
  position: absolute;
  top: -4px; right: -4px;
  font-size: 0.6rem;
  filter: none;
}
.av-premium-hint {
  font-size: 0.7rem;
  color: #a78bfa;
  text-align: right;
  margin-top: 2px;
  margin-bottom: 4px;
}

.av-color-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: block;
  border: 2px solid rgba(255,255,255,0.2);
}

.av-opt-emoji { font-size: 1.2rem; }
.av-opt-text { font-size: 0.72rem; color: var(--text); font-weight: 600; }

@media (max-width: 480px) {
  .av-opt-btn { min-width: 36px; height: 36px; }
  .av-color-dot { width: 18px; height: 18px; }
  .av-opt-emoji { font-size: 1rem; }
}

/* ─── KaTeX 보정 ─── */
.katex-display {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 0;
}

/* ═══════════════════════════════════════════════════════════
   대전 시스템 스타일
   ═══════════════════════════════════════════════════════════ */

/* ── 홈 대전 진입 카드 ── */
.battle-entry-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(135deg, #1e1e3f 0%, #2d1b69 100%);
  border: 2px solid #7c3aed;
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 16px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s;
  animation: fadeIn 0.4s ease;
}
.battle-entry-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(124,58,237,0.4);
}
.battle-entry-card.entry-locked {
  opacity: 0.65;
  cursor: not-allowed;
  pointer-events: auto;
}
.battle-entry-card.entry-locked:hover {
  transform: none;
  box-shadow: none;
}
.battle-entry-card.battle-entry-card-done {
  opacity: 0.65;
  filter: grayscale(0.5);
  background: rgba(80, 80, 90, 0.4);
  border-color: rgba(124, 124, 124, 0.5);
}
.battle-entry-card.battle-entry-card-done:hover {
  transform: none;
  box-shadow: none;
}
.battle-entry-done-badge {
  font-size: 1rem;
  font-weight: 700;
  color: #e53935;
  margin-left: 8px;
  display: inline-block;
  letter-spacing: 0.02em;
}
.battle-entry-icon {
  font-size: 2.2rem;
  flex-shrink: 0;
}
.battle-entry-info { flex: 1; }
.battle-entry-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #fff;
}
.battle-entry-desc {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.7);
  margin-top: 2px;
}
.battle-entry-level-req {
  margin-left: auto;
  font-size: 1.15rem;
  font-weight: 800;
  color: rgba(255,255,255,0.95);
  flex-shrink: 0;
}
.battle-entry-arrow {
  font-size: 1.5rem;
  color: rgba(255,255,255,0.5);
  font-weight: 700;
}

/* ── 대전 로비 ── */
.battle-lobby {
  text-align: center;
  padding: 20px 0;
}
.battle-lobby-icon {
  font-size: 4rem;
  margin: 16px 0;
  animation: float 3s ease-in-out infinite;
}
.battle-lobby-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: #7c3aed;
  margin-bottom: 6px;
}
.battle-lobby-desc {
  color: var(--text-dim);
  font-size: 0.95rem;
  margin-bottom: 20px;
}
.battle-lobby-info {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 20px;
}
.battle-info-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 0.85rem;
  font-weight: 600;
}
.battle-pool-status {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 16px;
  min-height: 40px;
}
/* 배틀 로비 장착 스킬 요약 */
.battle-equipped-skills {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 16px;
  text-align: center;
}
.equipped-label {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 6px;
  font-weight: 600;
}
.equipped-list {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
}
.equipped-link {
  font-size: 0.8rem;
  color: var(--primary);
  text-decoration: none;
  opacity: 0.8;
}
.equipped-link:hover { opacity: 1; text-decoration: underline; }
.battle-start-btn {
  background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
  color: #fff;
  border: none;
  border-radius: 14px;
  padding: 16px 40px;
  font-size: 1.15rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s;
}
.battle-start-btn:hover:not(:disabled) {
  transform: scale(1.05);
  box-shadow: 0 4px 20px rgba(124,58,237,0.5);
}
.battle-start-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ── 대전 HUD ── */
.battle-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 0;
  margin-bottom: 8px;
}
.battle-player {
  flex: 1;
  text-align: center;
  padding: 10px 8px;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: var(--surface);
  transition: border-color 0.3s, box-shadow 0.3s;
}
.battle-player.active-turn {
  border-color: #7c3aed;
  box-shadow: 0 0 12px rgba(124,58,237,0.4);
  animation: battleActivePulse 1.5s ease-in-out infinite;
}
.battle-avatar { font-size: 1.8rem; }
.battle-title-tag {
  font-size: 0.6rem;
  font-weight: 700;
  color: #7c3aed;
  background: linear-gradient(135deg, #f3e8ff 0%, #ede9fe 100%);
  border: 1px solid #ddd6fe;
  border-radius: 8px;
  padding: 1px 6px;
  margin-bottom: 1px;
  display: inline-block;
  white-space: nowrap;
  line-height: 1.4;
}
.battle-name {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text);
  margin: 2px 0;
}
.battle-sp {
  font-size: 1.1rem;
  font-weight: 800;
  color: #7c3aed;
}
.battle-score {
  font-size: 0.72rem;
  color: var(--text-dim);
}
.battle-vs {
  font-size: 1.2rem;
  font-weight: 900;
  color: var(--text-dim);
  flex-shrink: 0;
}

/* ── 타이머 바 ── */
.battle-timer-bar {
  width: 100%;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 6px;
}
.battle-timer-fill {
  height: 100%;
  background: var(--duo-green);
  border-radius: 4px;
  transition: width 0.05s linear, background 0.3s;
}

.battle-progress-text {
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-dim);
  font-weight: 600;
  margin-bottom: 10px;
}

.battle-difficulty {
  text-align: center;
  margin-bottom: 8px;
}

.battle-difficulty .play-difficulty {
  display: inline-block;
}

/* ── 대전 카드 ── */
.battle-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  max-width: 100%;
}
.battle-turn-label {
  text-align: center;
  font-size: 0.9rem;
  font-weight: 700;
  color: #7c3aed;
  margin-bottom: 12px;
  padding: 6px 12px;
  background: rgba(124,58,237,0.08);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.turn-label-pet {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.battle-feedback {
  margin-top: 12px;
}

/* ── 턴 교대 오버레이 ── */
.battle-turn-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.6);
  animation: hatchBgFadeIn 0.2s ease;
}
.battle-turn-text {
  font-size: 2rem;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 2px 12px rgba(0,0,0,0.5);
  animation: battleTurnPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── 대전 결과 화면 (강화 애니메이션) ── */
.battle-result {
  text-align: center;
  padding: 10px 0;
  position: relative;
  overflow: hidden;
  animation: resultSlideUp 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes resultSlideUp {
  0% { transform: translateY(40px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

/* 결과 이모지: 승리 시 빛나는 회전 + 바운스 */
.battle-result-emoji {
  font-size: 2.5rem;
  animation: resultEmojiBounce 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  position: relative;
  display: inline-block;
}
.result-win .battle-result-emoji {
  animation: resultTrophySpin 1.2s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  filter: drop-shadow(0 0 20px rgba(255,200,0,0.6));
}
@keyframes resultEmojiBounce {
  0% { transform: scale(0) rotate(-20deg); opacity: 0; }
  50% { transform: scale(1.3) rotate(5deg); opacity: 1; }
  70% { transform: scale(0.9) rotate(-3deg); }
  100% { transform: scale(1) rotate(0); }
}
@keyframes resultTrophySpin {
  0% { transform: scale(0) rotateY(0); opacity: 0; }
  30% { transform: scale(1.4) rotateY(360deg); opacity: 1; }
  50% { transform: scale(1.6) rotateY(540deg); filter: drop-shadow(0 0 30px rgba(255,200,0,0.9)); }
  70% { transform: scale(1.1) rotateY(680deg); }
  100% { transform: scale(1) rotateY(720deg); filter: drop-shadow(0 0 15px rgba(255,200,0,0.5)); }
}

/* 결과 타이틀: 타이핑 느낌 팝 */
.battle-result-title {
  font-size: 1.4rem;
  font-weight: 900;
  color: #7c3aed;
  margin: 4px 0 10px;
  animation: resultTitlePop 0.6s 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.result-win .battle-result-title {
  background: linear-gradient(90deg, #f59e0b, #ef4444, #ec4899, #8b5cf6, #3b82f6);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: resultTitlePop 0.6s 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both,
             resultRainbow 2s 1s linear infinite;
}
.result-lose .battle-result-title {
  color: #6b7280;
}
@keyframes resultTitlePop {
  0% { transform: scale(0.3) translateY(20px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}
@keyframes resultRainbow {
  0% { background-position: 0% 50%; }
  100% { background-position: 300% 50%; }
}

/* 전적 표시: 카운트업 애니메이션 + 색상 */
.ranked-record-summary {
  text-align: center;
  font-size: 0.85rem;
  color: #6b7280;
  margin: 2px 0 8px;
  font-weight: 700;
  animation: resultRecordSlide 0.5s 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
  display: flex;
  justify-content: center;
  gap: 12px;
}
.record-win { color: #10b981; font-weight: 800; }
.record-draw { color: #f59e0b; font-weight: 800; }
.record-lose { color: #ef4444; font-weight: 800; }
@keyframes resultRecordSlide {
  0% { transform: translateY(15px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

/* 점수 카드 영역 */
.battle-result-scores {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
}
.battle-result-side {
  flex: 1;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 12px 10px;
  text-align: center;
  animation: resultCardPop 0.5s 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.battle-result-side:last-child {
  animation-delay: 0.75s;
}
@keyframes resultCardPop {
  0% { transform: scale(0.7) translateY(20px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}
.battle-result-side.winner {
  border-color: #7c3aed;
  background: linear-gradient(135deg, rgba(124,58,237,0.05) 0%, rgba(168,85,247,0.1) 100%);
  animation: resultCardPop 0.5s 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both,
             winnerGlow 2s 1.2s ease infinite;
}
@keyframes winnerGlow {
  0%, 100% { box-shadow: 0 0 8px rgba(124,58,237,0.2); }
  50% { box-shadow: 0 0 20px rgba(124,58,237,0.5), 0 0 40px rgba(168,85,247,0.2); }
}
.battle-result-avatar {
  font-size: 1.6rem;
  animation: avatarBounceIn 0.4s 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes avatarBounceIn {
  0% { transform: scale(0) rotate(-15deg); }
  100% { transform: scale(1) rotate(0); }
}
.battle-result-title-tag {
  font-size: 0.6rem;
  font-weight: 700;
  color: #7c3aed;
  background: linear-gradient(135deg, #f3e8ff 0%, #ede9fe 100%);
  border: 1px solid #ddd6fe;
  border-radius: 8px;
  padding: 1px 6px;
  margin-bottom: 1px;
  display: inline-block;
  white-space: nowrap;
}
.battle-result-name {
  font-size: 0.85rem;
  font-weight: 700;
  margin: 4px 0;
}
.battle-result-sp {
  font-size: 1.2rem;
  font-weight: 900;
  color: #7c3aed;
  animation: spCountUp 0.6s 1s ease both;
}
@keyframes spCountUp {
  0% { transform: scale(0.5); opacity: 0; }
  60% { transform: scale(1.2); }
  100% { transform: scale(1); opacity: 1; }
}
.battle-result-stats {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-top: 4px;
}
.battle-result-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 900;
  color: var(--text-dim);
  text-align: center;
  padding: 6px 0;
  flex-shrink: 0;
}
/* ── 대전 보상 박스 ── */
.battle-reward-box {
  background: linear-gradient(135deg, rgba(245,158,11,0.08) 0%, rgba(251,191,36,0.15) 100%);
  border: 2px solid rgba(245,158,11,0.3);
  border-radius: 10px;
  padding: 14px 16px;
  margin: 8px 0;
  padding: 10px 14px;
  animation: resultCardPop 0.5s 0.9s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.battle-reward-title {
  font-size: 0.7rem;
  font-weight: 700;
  color: #b45309;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 10px;
}
.battle-reward-items {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
}
.battle-reward-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.battle-reward-icon {
  font-size: 1.2rem;
}
.battle-reward-value {
  font-size: 1rem;
  font-weight: 900;
  color: #d97706;
}
.battle-reward-label {
  font-size: 0.7rem;
  color: var(--text-dim);
  font-weight: 600;
}
.battle-reward-bonus .battle-reward-value {
  color: #7c3aed;
}

.battle-result-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 6px;
  animation: resultActionsIn 0.5s 1s ease both;
}
@keyframes resultActionsIn {
  0% { transform: translateY(20px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

/* ── 컨페티 파티클 (승리 시) ── */
.result-confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}
.confetti-piece {
  position: absolute;
  top: -10px;
  left: var(--x, 50%);
  width: 8px;
  height: 8px;
  border-radius: 2px;
  animation: confettiFall var(--d, 1.5s) calc(var(--i, 0) * 0.08s) ease-in forwards;
}
.confetti-piece:nth-child(5n+1) { background: #ef4444; width: 10px; height: 6px; }
.confetti-piece:nth-child(5n+2) { background: #f59e0b; width: 6px; height: 10px; }
.confetti-piece:nth-child(5n+3) { background: #10b981; width: 8px; height: 8px; border-radius: 50%; }
.confetti-piece:nth-child(5n+4) { background: #3b82f6; width: 12px; height: 4px; }
.confetti-piece:nth-child(5n+5) { background: #ec4899; width: 7px; height: 7px; }
@keyframes confettiFall {
  0% { transform: translateY(0) rotate(0) scale(1); opacity: 1; }
  50% { opacity: 1; }
  100% {
    transform: translateY(calc(100vh + 20px)) rotate(var(--r, 360deg)) scale(0.4);
    opacity: 0;
  }
}

/* ── 대전 키프레임 ── */
@keyframes battleActivePulse {
  0%, 100% { box-shadow: 0 0 12px rgba(124,58,237,0.4); }
  50% { box-shadow: 0 0 24px rgba(124,58,237,0.7); }
}
@keyframes battleTurnPop {
  0% { transform: scale(0.3); opacity: 0; }
  60% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(1); }
}

/* ── 대전 모바일 ── */
@media (max-width: 480px) {
  .battle-hud { gap: 3px; padding: 4px 0; margin-bottom: 4px; }
  .battle-player { padding: 6px 4px; border-radius: 10px; }
  .battle-pet-emoji { font-size: 1.5rem !important; }
  .battle-title-tag { font-size: 0.55rem; padding: 0px 4px; }
  .battle-name { font-size: 0.7rem; margin: 1px 0; }
  .battle-avatar { font-size: 1.4rem; }
  .battle-sp { font-size: 0.9rem; }
  .battle-score { font-size: 0.65rem; }
  .battle-vs { font-size: 1rem; }
  .battle-timer-bar { height: 6px; margin-bottom: 3px; }
  .battle-progress-text { font-size: 0.7rem; margin-bottom: 6px; }
  .battle-card { padding: 12px 10px; }
  .battle-turn-label { font-size: 0.75rem; margin-bottom: 6px; padding: 4px 10px; }
  .battle-skill-bar { gap: 4px; margin-top: 6px; }
  .battle-skill-btn { padding: 4px 6px; min-width: 60px; }
  .battle-skill-btn .skill-btn-name { font-size: 0.65rem; }
  .battle-skill-btn .skill-btn-cost { font-size: 0.6rem; }
  .battle-lobby-info { flex-direction: column; gap: 8px; }
  .battle-result-emoji { font-size: 2rem; }
  .battle-result-title { font-size: 1.1rem; margin: 2px 0 6px; }
  .battle-result-scores { flex-direction: row; align-items: flex-start; gap: 6px; }
  .battle-result-side { flex: 1; padding: 8px 6px; }
  .battle-result-avatar .pet-img { width: 72px; height: 72px; }
  .battle-result-divider { font-size: 0.8rem; }
  .battle-result-sp { font-size: 1rem; }
  .battle-result-stats { font-size: 0.65rem; }
  .battle-reward-box { margin: 6px 0; padding: 8px 10px; }
  .battle-reward-icon { font-size: 1rem; }
  .battle-reward-value { font-size: 0.85rem; }
  .ranked-result .battle-result-emoji { font-size: 2.2rem; }
  .skill-gate-choices { flex-direction: column; }
  .skill-choice-btn { min-width: auto; }
}

/* ═══════════════════════════════════════════════════════════
   스킬 시스템 스타일
   ═══════════════════════════════════════════════════════════ */

/* ── 스킬 선택 패널 (로비) ── */
.skill-select-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 20px;
}
.skill-locked-msg {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.95rem;
  padding: 20px 0;
}
.skill-change-hint {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin: 0 0 12px 0;
  padding: 0;
}
/* 접기/펼치기 헤더 */
.skill-panel-header {
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 2px 0;
  gap: 8px;
  user-select: none;
}
.skill-panel-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: #7c3aed;
  margin: 0;
  flex: 1;
}
.skill-panel-summary {
  font-size: 0.8rem;
  color: var(--text-dim);
  font-weight: 600;
}
.skill-view-btn {
  font-size: 0.75rem;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface2, rgba(124,58,237,0.1));
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.skill-view-btn:hover {
  background: rgba(124,58,237,0.2);
  border-color: #7c3aed;
}
.skill-panel-arrow {
  font-size: 0.75rem;
  color: var(--text-dim);
  transition: transform 0.25s ease;
}
.skill-open .skill-panel-arrow {
  transform: rotate(180deg);
}
/* 접힌 상태 (기본) */
.skill-panel-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
}
/* 펼친 상태 */
.skill-open .skill-panel-body {
  max-height: 2000px;
  margin-top: 12px;
}
.skill-gate {
  margin-bottom: 14px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(124,58,237,0.03);
}
.skill-gate.locked {
  opacity: 0.5;
}
.skill-gate.unlocked {
  border-color: rgba(124,58,237,0.3);
}
.skill-gate.master {
  border-color: var(--gold);
  background: rgba(255,150,0,0.05);
}
.skill-gate-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-dim);
  margin-bottom: 8px;
}
.skill-gate-choices {
  display: flex;
  gap: 8px;
}
.skill-choice-btn {
  flex: 1;
  min-width: 120px;
  padding: 10px 12px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.2s, background 0.2s;
}
.skill-choice-btn:hover:not(.disabled) {
  border-color: #7c3aed;
  background: rgba(124,58,237,0.05);
}
.skill-choice-btn.selected {
  border-color: #7c3aed;
  background: rgba(124,58,237,0.1);
  box-shadow: 0 0 8px rgba(124,58,237,0.2);
  position: relative;
}
.skill-choice-btn.selected::after {
  content: '✓';
  position: absolute;
  top: 6px;
  right: 8px;
  font-size: 1rem;
  font-weight: 700;
  color: #7c3aed;
}
.skill-choice-btn.disabled {
  cursor: not-allowed;
  opacity: 0.5;
}
.skill-choice-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
}
.skill-choice-desc {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 2px;
}
.skill-choice-kind {
  font-size: 0.65rem;
  font-weight: 700;
  color: #7c3aed;
  margin-top: 4px;
  text-transform: uppercase;
}
.skill-master-info {
  padding: 6px 0;
}

/* ── 대전 중 스킬 바 ── */
.battle-skill-bar {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.battle-skill-btn {
  position: relative;
  background: linear-gradient(135deg, #312e81 0%, #4c1d95 100%);
  border: 2px solid #7c3aed;
  border-radius: 10px;
  padding: 8px 14px;
  color: #fff;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s;
  min-width: 80px;
  text-align: center;
}
.battle-skill-btn:hover:not(.disabled) {
  transform: scale(1.05);
  box-shadow: 0 0 12px rgba(124,58,237,0.5);
}
.battle-skill-btn.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  border-color: #555;
}
.skill-btn-name {
  font-size: 0.78rem;
  font-weight: 700;
}
.skill-btn-cost {
  font-size: 0.65rem;
  color: rgba(255,255,255,0.7);
}
.skill-btn-cd {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #ef4444;
  color: #fff;
  font-size: 0.6rem;
  font-weight: 800;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── 스킬 발동 로그 ── */
.battle-skill-log {
  margin-top: 10px;
  max-height: 140px;
  overflow-y: auto;
  background: #faf5ff;
  border: 1px solid #e9d5ff;
  border-radius: 10px;
  padding: 6px 10px;
  scroll-behavior: smooth;
}
.battle-skill-log.compact {
  margin-top: 6px;
  max-height: 72px;
  padding: 4px 8px;
  font-size: 0.7rem;
}
.battle-skill-log.compact .skill-log-item {
  padding: 2px 4px;
  font-size: 0.7rem;
}
.battle-skill-log:empty {
  display: none;
}
.battle-skill-log::-webkit-scrollbar {
  width: 4px;
}
.battle-skill-log::-webkit-scrollbar-thumb {
  background: #d8b4fe;
  border-radius: 4px;
}
.skill-log-item {
  font-size: 0.78rem;
  font-weight: 600;
  color: #7c3aed;
  padding: 5px 6px;
  border-bottom: 1px solid #f3e8ff;
  opacity: 0.7;
  transition: opacity 0.3s ease;
}
.skill-log-item:last-child {
  border-bottom: none;
}
/* ★ 최신(맨 위) 스킬 강조 */
.skill-log-newest {
  opacity: 1;
  background: linear-gradient(90deg, rgba(124, 58, 237, 0.08) 0%, transparent 100%);
  border-radius: 6px;
  border-left: 3px solid #7c3aed;
  animation: skillLogSlideIn 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes skillLogSlideIn {
  0% { opacity: 0; transform: translateX(-20px); }
  100% { opacity: 1; transform: translateX(0); }
}

/* ── 스킬 발동 배너 (슬로우모션 느낌) ── */
.skill-banner {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%) translateY(-10px);
  z-index: 9999;
  background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
  color: #fff;
  border-radius: 14px;
  padding: 10px 20px;
  text-align: center;
  box-shadow: 0 6px 24px rgba(124, 58, 237, 0.4), 0 0 60px rgba(124, 58, 237, 0.3);
  animation: skillBannerIn 0.85s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  max-width: 90vw;
}
.skill-banner-title {
  font-size: 0.95rem;
  font-weight: 800;
  margin-bottom: 2px;
}
.skill-banner-desc {
  font-size: 0.75rem;
  font-weight: 500;
  opacity: 0.85;
}
.skill-banner-out {
  animation: skillBannerOut 0.5s ease forwards;
}
@keyframes skillBannerIn {
  0% { transform: translateX(-50%) translateY(-80px) scale(0.5); opacity: 0; filter: blur(4px); }
  50% { transform: translateX(-50%) translateY(-15px) scale(1.08); opacity: 1; filter: blur(0); }
  70% { transform: translateX(-50%) translateY(2px) scale(1.02); }
  85% { transform: translateX(-50%) translateY(-2px) scale(1.01); }
  100% { transform: translateX(-50%) translateY(0) scale(1); opacity: 1; filter: blur(0); }
}
@keyframes skillBannerOut {
  0% { transform: translateX(-50%) translateY(0) scale(1); opacity: 1; }
  100% { transform: translateX(-50%) translateY(-40px) scale(0.85); opacity: 0; }
}

/* 스킬 발동 시 잠깐 슬로우/임팩트 느낌 오버레이 */
.skill-impact-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(124, 58, 237, 0.15) 0%, transparent 70%);
  animation: skillImpactFlash 0.6s ease-out forwards;
}
@keyframes skillImpactFlash {
  0% { opacity: 1; }
  40% { opacity: 0.6; }
  100% { opacity: 0; }
}

/* ══════════════════════════════════════════════════════════ */
/* 경쟁 대전 (Ranked Battle) 스타일                         */
/* ══════════════════════════════════════════════════════════ */

/* ── 홈 카드 ── */
.ranked-entry-card {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%) !important;
  border-color: #d97706 !important;
}
.ranked-entry-card .battle-entry-icon {
  font-size: 2rem;
}
.ranked-entry-card .battle-entry-title {
  color: #78350f;
}
.ranked-entry-card .battle-entry-desc {
  color: #92400e;
}

/* 사회적 기능 카드 (초대/순위/학습방) */
.social-entry-card {
  background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%) !important;
  border-color: #0e7490 !important;
}
.social-entry-card .battle-entry-title {
  color: #083344;
}
.social-entry-card .battle-entry-desc {
  color: #155e75;
}

/* ── 친구 초대 / 순위표 / 학습방 페이지 ── */
.social-page-card {
  background: var(--card);
  border-radius: 16px;
  padding: 20px;
  margin: 12px 0;
  border: 1px solid var(--border);
}
.social-page-title {
  font-size: 1.2rem;
  font-weight: 800;
  margin-bottom: 8px;
  color: var(--text);
}
.social-page-desc {
  font-size: 0.9rem;
  color: var(--sub);
  margin-bottom: 16px;
  line-height: 1.5;
}
.invite-code-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg);
  border-radius: 12px;
  margin-bottom: 12px;
  border: 2px solid var(--accent);
}
.invite-code-box span {
  font-family: monospace;
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: 4px;
  color: var(--accent);
}
.invite-copy-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}
.invite-copy-btn:hover { opacity: 0.9; }
.invite-count {
  font-size: 0.95rem;
  color: var(--sub);
}
.ranking-week-label {
  font-size: 0.9rem;
  color: var(--sub);
  margin-bottom: 12px;
}
.ranking-reward-info-wrap {
  margin-bottom: 16px;
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.08) 0%, rgba(124, 58, 237, 0.08) 100%);
  border-radius: 14px;
  border: 1px solid rgba(255, 215, 0, 0.25);
  overflow: hidden;
}
.ranking-reward-info-toggle {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px;
  background: transparent;
  border: none;
  border-radius: 0;
  color: var(--text);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: background 0.2s;
}
.ranking-reward-info-toggle:hover { background: rgba(255, 215, 0, 0.1); }
.ranking-reward-info-icon {
  font-size: 1.25rem;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3));
}
.ranking-reward-info-body {
  padding: 16px 16px 18px;
  background: rgba(0, 0, 0, 0.15);
}
.ranking-reward-info-desc {
  font-size: 0.9rem;
  color: var(--sub);
  margin-bottom: 14px;
  line-height: 1.55;
  padding: 0 2px;
}
.ranking-reward-table { display: flex; flex-direction: column; gap: 8px; }
.ranking-reward-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.9rem;
  transition: transform 0.15s;
  border-left: 4px solid transparent;
}
.ranking-reward-row:hover { transform: translateX(4px); }
.ranking-reward-row.rank-1 {
  background: linear-gradient(90deg, rgba(255, 215, 0, 0.2) 0%, rgba(255, 215, 0, 0.05) 100%);
  border-left-color: #ffd700;
}
.ranking-reward-row.rank-2 {
  background: linear-gradient(90deg, rgba(192, 192, 192, 0.2) 0%, rgba(192, 192, 192, 0.05) 100%);
  border-left-color: #c0c0c0;
}
.ranking-reward-row.rank-3 {
  background: linear-gradient(90deg, rgba(205, 127, 50, 0.2) 0%, rgba(205, 127, 50, 0.05) 100%);
  border-left-color: #cd7f32;
}
.ranking-reward-row.rank-4,
.ranking-reward-row.rank-5 {
  background: rgba(255, 255, 255, 0.04);
  border-left-color: var(--accent);
}
.ranking-reward-row span:first-child {
  font-weight: 700;
  font-size: 0.95rem;
  min-width: 40px;
}
.ranking-reward-row.rank-1 span:first-child { color: #ffd700; }
.ranking-reward-row.rank-2 span:first-child { color: #c0c0c0; }
.ranking-reward-row.rank-3 span:first-child { color: #cd7f32; }
.ranking-reward-row span:last-child { color: var(--text); font-weight: 500; }
.ranking-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.ranking-tab {
  padding: 10px 18px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: transparent;
  color: var(--sub);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.ranking-tab:hover, .ranking-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.ranking-list {
  min-height: 120px;
}
.ranking-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.ranking-row:last-child { border-bottom: none; }
.ranking-row-me {
  background: rgba(124, 58, 237, 0.15);
  border-radius: 8px;
  margin: 0 -8px;
  padding: 12px 8px;
}
.rank-me-badge {
  font-size: 0.7rem;
  padding: 2px 6px;
  background: var(--accent);
  color: #fff;
  border-radius: 4px;
  margin-left: 6px;
  font-weight: 600;
}
.rank-badge {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  font-weight: 800;
  font-size: 0.9rem;
}
.rank-name { font-weight: 600; flex: 1; }
.rank-grade { font-size: 0.8rem; color: var(--sub); margin-right: 8px; }
.rank-value { font-weight: 700; color: var(--accent); }
.groups-list { min-height: 80px; }
.group-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.2s;
}
.group-row:hover { background: rgba(124,58,237,0.08); }
.group-row:last-child { border-bottom: none; }
.group-name { font-weight: 700; flex: 1; }
.group-meta { font-size: 0.85rem; color: var(--sub); }
.group-arrow { color: var(--sub); font-size: 1.2rem; }
.group-members { margin-top: 12px; }
.group-member-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.group-member-row:last-child { border-bottom: none; }
.member-rank {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  font-weight: 700;
  font-size: 0.8rem;
}
.member-name { font-weight: 600; flex: 1; }
.member-stats { font-size: 0.85rem; color: var(--sub); }
.social-empty {
  text-align: center;
  padding: 24px;
  color: var(--sub);
  font-size: 0.95rem;
}

/* ── 매칭 로비 ── */
.ranked-lobby {
  text-align: center;
  padding: 16px 0;
}
.ranked-lobby-icon {
  font-size: 4rem;
  margin: 12px 0;
  animation: rankedTrophyBounce 1.5s ease infinite;
}
@keyframes rankedTrophyBounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}
.ranked-lobby-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: #d97706;
  margin: 4px 0;
}
.ranked-lobby-desc {
  color: #78716c;
  font-size: 0.95rem;
  margin-bottom: 20px;
}

/* 경쟁 대전 모드 선택 카드 */
.ranked-mode-cards {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 8px;
}
.ranked-mode-card {
  background: #fff;
  border: 2px solid #e5e7eb;
  border-radius: 16px;
  padding: 20px 16px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}
.ranked-mode-card:hover {
  border-color: #fbbf24;
  box-shadow: 0 4px 16px rgba(251, 191, 36, 0.2);
  transform: translateY(-2px);
}
.ranked-mode-card:active {
  transform: scale(0.97);
}
.ranked-mode-icon {
  font-size: 2.8rem;
  margin-bottom: 8px;
}
.ranked-mode-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 4px;
}
.ranked-mode-desc {
  font-size: 0.82rem;
  color: #6b7280;
  line-height: 1.4;
}
.ranked-mode-badge {
  display: inline-block;
  background: #fef3c7;
  color: #92400e;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  vertical-align: middle;
  margin-left: 4px;
}
.ranked-mode-badge.unlimited {
  background: #d1fae5;
  color: #065f46;
}
.ranked-mode-upgrade {
  font-size: 0.78rem;
  color: #d97706;
  margin-top: 10px;
  opacity: 0.8;
}

/* 매칭 중 */
.ranked-matching {
  background: #fffbeb;
  border: 2px dashed #fbbf24;
  border-radius: 16px;
  padding: 24px;
  margin: 12px 0;
  transition: all 0.4s ease;
}
.ranked-matching.matched {
  border-style: solid;
  border-color: #16a34a;
  background: #f0fdf4;
}
.matching-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #fde68a;
  border-top-color: #f59e0b;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 12px;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.matching-text {
  font-size: 1rem;
  font-weight: 600;
  color: #92400e;
}

/* 매칭 완료 프로필 */
.matched-profile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-bottom: 8px;
}
.matched-flag {
  font-size: 3rem;
  line-height: 1;
}
.matched-name {
  font-size: 1.3rem;
  font-weight: 800;
  color: #1f2937;
}
.matched-info {
  font-size: 0.85rem;
  color: #6b7280;
}
.matched-text {
  font-size: 1rem;
  font-weight: 700;
  color: #16a34a;
  margin-top: 8px;
}

/* 시작 버튼 */
.ranked-start-btn {
  background: linear-gradient(135deg, #fbbf24, #f59e0b) !important;
  border-color: #d97706 !important;
  color: #78350f !important;
  font-size: 1.1rem;
}
.ranked-start-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #f59e0b, #d97706) !important;
  transform: translateY(-2px);
}

/* ── 결과 ── */
.ranked-result .battle-result-emoji {
  font-size: 2.8rem;
}
.battle-result-detail {
  font-size: 0.75rem;
  color: #9ca3af;
  margin-top: 2px;
}
.ranked-replay {
  background: linear-gradient(135deg, #fbbf24, #f59e0b) !important;
  border-color: #d97706 !important;
  color: #78350f !important;
}

/* ── 학부모 대시보드 경쟁 대전 섹션 ── */
.parent-ranked-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-bottom: 16px;
  min-width: 0;
}
.parent-mr-row {
  margin-bottom: 12px;
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--surface2, #f8fafc) 0%, var(--surface, #fff) 100%);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  font-size: 0.9rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.parent-mr-row-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
}
.parent-mr-label {
  font-weight: 600;
  color: var(--text, #334155);
  font-size: 0.9rem;
}
.parent-mr-val {
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--primary, #2563eb);
  letter-spacing: -0.02em;
  padding: 2px 10px;
  background: rgba(37, 99, 235, 0.08);
  border-radius: 8px;
}
.parent-mr-meta {
  color: var(--text-muted, #64748b);
  font-size: 0.85rem;
  padding: 4px 10px;
  background: var(--surface2, #f1f5f9);
  border-radius: 6px;
  font-weight: 500;
}
.parent-mr-note {
  color: var(--text-muted, #64748b);
  font-size: 0.82rem;
  font-style: normal;
}
.parent-ranked-history {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  margin-top: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.parent-ranked-history-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.parent-ranked-row {
  display: grid;
  grid-template-columns: 65px minmax(0, 1fr) 72px 90px;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
  min-width: 0;
}
.parent-ranked-row:last-child {
  border-bottom: none;
}
.parent-ranked-row.win {
  background: rgba(88, 204, 2, 0.1);
}
.parent-ranked-row.loss {
  background: rgba(255, 75, 75, 0.1);
}
.parent-ranked-row.draw {
  background: rgba(255, 150, 0, 0.1);
}
.parent-ranked-date-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.parent-ranked-date {
  color: var(--text-dim);
  font-size: 0.75rem;
}
.parent-ranked-date-type {
  font-size: 0.7rem;
  color: var(--sub);
  white-space: nowrap;
}
.parent-ranked-opponent {
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  color: var(--text);
  min-width: 0;
  overflow: hidden;
}
.parent-ranked-opponent > span:not(.parent-ranked-flag):not(.parent-ranked-lvl) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.parent-ranked-flag {
  font-size: 1.1rem;
  flex-shrink: 0;
}
.parent-ranked-lvl {
  font-size: 0.7rem;
  color: var(--text-dim);
  font-weight: 400;
  flex-shrink: 0;
}
.parent-ranked-result {
  font-weight: 700;
  font-size: 0.8rem;
  text-align: center;
}
.parent-ranked-score {
  color: var(--text-dim);
  font-weight: 600;
  font-size: 0.75rem;
  text-align: center;
}
.parent-ranked-acc {
  color: var(--text-dim);
  font-size: 0.75rem;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

/* OX 게임 기록: 3열 레이아웃 */
.parent-ranked-history--ox .parent-ranked-row {
  grid-template-columns: 65px 1fr 80px;
}

/* ── 국기 이미지 ── */
.flag-icon {
  width: 28px;
  height: 20px;
  object-fit: cover;
  border-radius: 3px;
  vertical-align: middle;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.flag-icon.flag-sm {
  width: 18px;
  height: 13px;
  border-radius: 2px;
  margin-right: 2px;
}

/* ── 매칭 로비: 상대 펫 표시 ── */
.matched-pet-emoji {
  font-size: 2.5rem;
  margin-bottom: 4px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.matched-pet-type {
  font-size: 0.75rem;
  color: #9ca3af;
  margin-top: 2px;
}
.matched-flag {
  margin-bottom: 4px;
}

/* ── HUD 상대 펫 아바타 + 국기 뱃지 ── */
.battle-avatar {
  position: relative;
}
.battle-name .flag-icon {
  margin-right: 3px;
  vertical-align: -2px;
}

/* ── 상대 스킬 발동 로그 강조 (기존 skillLogSlideIn 활용) ── */

/* ── 결과 화면 국기 ── */
.battle-result-detail .flag-icon {
  margin-right: 4px;
  vertical-align: -3px;
}

/* ── 상대 정답/오답 피드백 오버레이 ── */
.opp-result-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.35);
  animation: oppResultIn 0.25s ease;
}
.opp-result-overlay.opp-result-out {
  animation: oppResultOut 0.3s ease forwards;
}
@keyframes oppResultIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes oppResultOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

.opp-result-card {
  background: #fff;
  border-radius: 20px;
  padding: 28px 36px;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  animation: oppCardPop 0.35s cubic-bezier(0.34,1.56,0.64,1);
  min-width: 200px;
}
@keyframes oppCardPop {
  from { transform: scale(0.5); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.opp-result-pet {
  font-size: 2.8rem;
  margin-bottom: 4px;
  animation: oppPetBounce 0.5s ease;
}
@keyframes oppPetBounce {
  0%, 100% { transform: translateY(0); }
  40% { transform: translateY(-12px); }
  60% { transform: translateY(-4px); }
}

.opp-result-icon {
  font-size: 2.2rem;
  margin-bottom: 4px;
}

.opp-result-correct {
  border: 3px solid #22c55e;
}
.opp-result-correct .opp-result-icon {
  animation: oppCorrectPulse 0.5s ease;
}
@keyframes oppCorrectPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.3); }
}

.opp-result-wrong {
  border: 3px solid #ef4444;
}
.opp-result-wrong .opp-result-icon {
  animation: oppWrongShake 0.4s ease;
}
@keyframes oppWrongShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}

.opp-result-text {
  font-size: 1.1rem;
  font-weight: 700;
  color: #374151;
  margin-top: 4px;
}
.opp-result-sp {
  font-size: 0.9rem;
  font-weight: 600;
  color: #22c55e;
  margin-top: 6px;
}
.opp-result-miss {
  font-size: 1.6rem;
  font-weight: 900;
  color: #ef4444;
  letter-spacing: 4px;
  margin-top: 6px;
  animation: oppMissSlam 0.3s ease;
}
@keyframes oppMissSlam {
  from { transform: scale(2); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ── 피드백 오버레이 내 스킬 발동 표시 ── */
.opp-result-skills {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #e5e7eb;
}
.opp-result-skill-item {
  font-size: 0.78rem;
  color: #6b7280;
  padding: 3px 8px;
  background: #f3f4f6;
  border-radius: 8px;
  margin-top: 4px;
  animation: skillItemSlide 0.3s ease;
}
.opp-result-skill-item strong {
  color: #7c3aed;
  font-weight: 700;
}
@keyframes skillItemSlide {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ── 스킬 로그 설명 텍스트 ── */
.skill-log-desc {
  font-size: 0.72rem;
  color: #9ca3af;
  font-weight: 400;
  margin-left: 4px;
}
.skill-log-item strong {
  color: #7c3aed;
}

/* ══════════════════════════════════════════════════════════ */
/* 펫 공격/피격 애니메이션 (강화)                              */
/* ══════════════════════════════════════════════════════════ */
.battle-pet-emoji {
  font-size: 2rem;
  transition: transform 0.15s ease, filter 0.2s ease;
  position: relative;
  z-index: 2;
}
/* 복습 대전 봇 이모지 3배 확대 */
.battle-bot-emoji {
  font-size: 6rem;
  line-height: 1;
  display: inline-block;
}
/* 인트로 화면: 봇 이모지를 내 펫(64px)과 같은 크기로 통일 */
.battle-bot-emoji-intro {
  font-size: 4rem;
  line-height: 1;
  display: inline-block;
}
.battle-bot-emoji-result {
  font-size: 3.5rem;
}
.ranked-intro-avatar:has(.battle-bot-emoji-intro) {
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── 차지 이펙트 (공격 전 에너지 모임) ── */
.pet-charge {
  animation: petCharge 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes petCharge {
  0% { transform: scale(1); filter: brightness(1); }
  40% { transform: scale(1.35); filter: brightness(1.8) drop-shadow(0 0 20px #fbbf24); }
  70% { transform: scale(1.2); filter: brightness(1.5); }
  100% { transform: scale(1.1); filter: brightness(1.3); }
}

/* ── 내 펫 → 오른쪽으로 돌진 (과감하게) ── */
.pet-attack-right {
  animation: petAttackRight 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes petAttackRight {
  0% { transform: translateX(0) scale(1) rotate(0); }
  12% { transform: translateX(-12px) scale(1.2) rotate(-10deg); }
  30% { transform: translateX(65px) scale(1.5) rotate(6deg); filter: brightness(1.6); }
  45% { transform: translateX(70px) scale(1.6) rotate(0); filter: brightness(2) drop-shadow(0 0 20px rgba(255,200,0,0.9)); }
  65% { transform: translateX(35px) scale(1.2) rotate(-3deg); }
  100% { transform: translateX(0) scale(1) rotate(0); filter: brightness(1); }
}

/* ── 상대 펫 → 왼쪽으로 돌진 (과감하게) ── */
.pet-attack-left {
  animation: petAttackLeft 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes petAttackLeft {
  0% { transform: translateX(0) scale(1) rotate(0); }
  12% { transform: translateX(12px) scale(1.2) rotate(10deg); }
  30% { transform: translateX(-65px) scale(1.5) rotate(-6deg); filter: brightness(1.6); }
  45% { transform: translateX(-70px) scale(1.6) rotate(0); filter: brightness(2) drop-shadow(0 0 20px rgba(255,200,0,0.9)); }
  65% { transform: translateX(-35px) scale(1.2) rotate(3deg); }
  100% { transform: translateX(0) scale(1) rotate(0); filter: brightness(1); }
}

/* ── 화면 흔들림 (과감하게) ── */
.screen-shake {
  animation: screenShake 0.55s ease;
}
@keyframes screenShake {
  0%, 100% { transform: translate(0,0); }
  8% { transform: translate(-8px, 5px); }
  16% { transform: translate(10px, -6px); }
  24% { transform: translate(-10px, 4px); }
  32% { transform: translate(8px, -5px); }
  40% { transform: translate(-6px, 3px); }
  50% { transform: translate(5px, -4px); }
  60% { transform: translate(-4px, 2px); }
  70% { transform: translate(3px, -2px); }
  80% { transform: translate(-2px, 1px); }
  90% { transform: translate(1px, 0); }
}

/* ── 피격 흔들림 (과감하게) ── */
.pet-hit-shake {
  animation: petHitShake 0.75s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}
@keyframes petHitShake {
  0%, 100% { transform: translateX(0) scale(1) rotate(0deg); }
  6% { transform: translateX(-18px) rotate(-8deg) scale(0.9); }
  14% { transform: translateX(18px) rotate(8deg) scale(0.88); }
  22% { transform: translateX(-14px) rotate(-6deg) scale(0.91); }
  30% { transform: translateX(14px) rotate(6deg) scale(0.92); }
  38% { transform: translateX(-10px) rotate(-4deg) scale(0.94); }
  46% { transform: translateX(10px) rotate(4deg) scale(0.95); }
  54% { transform: translateX(-6px) rotate(-2deg); }
  62% { transform: translateX(6px) rotate(2deg); }
  70% { transform: translateX(-4px); }
  78% { transform: translateX(4px); }
  86% { transform: translateX(-2px); }
  94% { transform: translateX(1px); }
}

/* ── 피격 플래시 (빨간 깜빡임, 과감하게) ── */
.hit-flash .battle-pet-emoji {
  animation: hitFlash 0.65s ease;
}
@keyframes hitFlash {
  0% { filter: brightness(1); }
  12% { filter: brightness(0.2) sepia(1) hue-rotate(-30deg) saturate(4); }
  25% { filter: brightness(1.6); }
  40% { filter: brightness(0.3) sepia(1) hue-rotate(-25deg) saturate(3); }
  55% { filter: brightness(1.3); }
  75% { filter: brightness(0.5) saturate(0.7); }
  100% { filter: brightness(1); }
}

/* ── 다중 스파크 (방사형) ── */
.hit-sparks {
  position: absolute;
  top: 50%;
  left: 50%;
  font-size: 1.4rem;
  pointer-events: none;
  z-index: 100;
}
.hit-sparks.multi-spark {
  animation: multiSparkBurst 0.7s ease forwards;
}
@keyframes multiSparkBurst {
  0% {
    transform: translate(-50%, -50%) rotate(var(--angle, 0deg)) translateY(0) scale(0.3);
    opacity: 1;
  }
  30% {
    transform: translate(-50%, -50%) rotate(var(--angle, 0deg)) translateY(calc(var(--dist, 25px) * -0.7)) scale(1.3);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) rotate(var(--angle, 0deg)) translateY(calc(var(--dist, 25px) * -1.2)) scale(0);
    opacity: 0;
  }
}

/* ── 데미지 숫자 ── */
.damage-number {
  position: absolute;
  top: -5px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.6rem;
  font-weight: 900;
  color: #ef4444;
  text-shadow: 0 0 6px rgba(239,68,68,0.6), 2px 2px 0 #fff;
  pointer-events: none;
  z-index: 110;
  animation: damageFloat 1.1s ease forwards;
}
@keyframes damageFloat {
  0% { transform: translateX(-50%) translateY(0) scale(0.5); opacity: 0; }
  15% { transform: translateX(-50%) translateY(-8px) scale(1.4); opacity: 1; }
  30% { transform: translateX(-50%) translateY(-14px) scale(1); opacity: 1; }
  100% { transform: translateX(-50%) translateY(-40px) scale(0.8); opacity: 0; }
}

/* ── 충격파 링 ── */
.hit-shockwave {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 3px solid rgba(255, 200, 0, 0.8);
  pointer-events: none;
  z-index: 90;
  animation: shockwaveExpand 0.5s ease-out forwards;
}
@keyframes shockwaveExpand {
  0% {
    transform: translate(-50%, -50%) scale(0);
    opacity: 1;
    border-width: 4px;
    border-color: rgba(255, 200, 0, 0.9);
  }
  60% {
    transform: translate(-50%, -50%) scale(5);
    opacity: 0.5;
    border-width: 2px;
    border-color: rgba(255, 150, 0, 0.5);
  }
  100% {
    transform: translate(-50%, -50%) scale(8);
    opacity: 0;
    border-width: 1px;
  }
}

/* ══════════════════════════════════════════════════════════ */
/* 복습 대전 인트로 (간단 카운트다운)                         */
/* ══════════════════════════════════════════════════════════ */
.battle-intro-overlay {
  background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 50%, #1e3a5f 100%);
}
.battle-intro-vs-badge {
  font-size: 2.5rem;
  font-weight: 900;
  color: #fbbf24;
  text-shadow: 0 2px 10px rgba(0,0,0,0.4);
  animation: countdownPop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ══════════════════════════════════════════════════════════ */
/* 경쟁 대전 인트로 (주사위 + 선공 + 카운트다운)             */
/* ══════════════════════════════════════════════════════════ */
.ranked-intro-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #1e1b4b 100%);
  animation: introFadeIn 0.4s ease;
}
@keyframes introFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.ranked-intro-card {
  text-align: center;
  padding: 32px;
  width: 90%;
  max-width: 400px;
}

.ranked-intro-teams {
  display: flex;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 16px;
}
.team-badge {
  font-size: 0.85rem;
  font-weight: 800;
  padding: 4px 12px;
  border-radius: 8px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
.team-red {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  color: #fff;
  border: 2px solid #f87171;
}
.team-blue {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  border: 2px solid #60a5fa;
}
.team-red-side .ranked-intro-avatar { border-color: #ef4444; box-shadow: 0 0 12px rgba(239,68,68,0.4); }
.team-blue-side .ranked-intro-avatar { border-color: #3b82f6; box-shadow: 0 0 12px rgba(59,130,246,0.4); }
.team-label {
  font-size: 0.75rem;
  font-weight: 800;
  margin-bottom: 4px;
  display: block;
}
.team-red-label { color: #f87171; }
.team-blue-label { color: #60a5fa; }

.ranked-intro-vs {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-bottom: 24px;
}

.ranked-intro-player {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.ranked-intro-avatar {
  font-size: 3rem;
  width: 72px;
  height: 72px;
  overflow: visible;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.1);
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.2);
  overflow: hidden;
}
.ranked-intro-my {
  background: rgba(255,255,255,0.15);
  padding: 4px;
}
.ranked-intro-my .avatar-wrap {
  transform: scale(0.95);
}

.ranked-intro-title {
  font-size: 0.65rem;
  font-weight: 700;
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.15);
  border: 1px solid rgba(251, 191, 36, 0.3);
  border-radius: 8px;
  padding: 1px 8px;
  margin-bottom: 2px;
  display: inline-block;
  white-space: nowrap;
}

.ranked-intro-name {
  color: #e0e7ff;
  font-size: 1rem;
  font-weight: 700;
}

.ranked-intro-dice {
  font-size: 3.5rem;
  animation: diceShake 0.12s ease infinite alternate;
  filter: drop-shadow(0 0 12px rgba(250,204,21,0.5));
}
@keyframes diceShake {
  from { transform: rotate(-15deg) scale(1); }
  to { transform: rotate(15deg) scale(1.1); }
}

.ranked-intro-dice.dice-result {
  animation: diceReveal 0.5s cubic-bezier(0.34,1.56,0.64,1) forwards;
}
@keyframes diceReveal {
  0% { transform: scale(1.5) rotate(360deg); opacity: 0.5; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.ranked-intro-status {
  color: #c7d2fe;
  font-size: 1.1rem;
  font-weight: 600;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ranked-first-announce {
  display: flex;
  align-items: center;
  gap: 10px;
  animation: firstAnnounce 0.5s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes firstAnnounce {
  from { transform: scale(0.5); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.ranked-first-emoji {
  font-size: 2rem;
}
.ranked-first-text {
  font-size: 1.4rem;
  font-weight: 900;
  color: #fbbf24;
  text-shadow: 0 2px 8px rgba(251,191,36,0.4);
}

.ranked-intro-countdown {
  font-size: 5rem;
  font-weight: 900;
  color: #fff;
  margin-top: 20px;
  text-shadow: 0 4px 20px rgba(0,0,0,0.4);
  animation: countdownPop 0.4s cubic-bezier(0.34,1.56,0.64,1);
}

.countdown-pulse {
  animation: countdownPop 0.4s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes countdownPop {
  0% { transform: scale(2); opacity: 0.3; }
  60% { transform: scale(0.9); }
  100% { transform: scale(1); opacity: 1; }
}

.countdown-go {
  color: #fbbf24;
  font-size: 6rem;
  animation: goExplode 0.5s cubic-bezier(0.34,1.56,0.64,1);
  text-shadow: 0 0 30px rgba(251,191,36,0.6), 0 0 60px rgba(251,191,36,0.3);
}
@keyframes goExplode {
  0% { transform: scale(3); opacity: 0; }
  50% { transform: scale(0.8); }
  100% { transform: scale(1); opacity: 1; }
}

/* ══════════════════════════════════════════════════════════════
   학업 성취도 분석 대시보드 (Achievement Dashboard)
   ══════════════════════════════════════════════════════════════ */

.achievement-overview {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  margin: 12px 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
  max-width: 100%;
  overflow: hidden;
}
.achievement-gauge-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  max-width: 100%;
}
.achievement-gauge {
  width: 130px;
  height: 130px;
  max-width: 100%;
  flex-shrink: 0;
}
.gauge-svg { width: 100%; height: 100%; }
.achievement-level {
  font-size: 1.3rem;
  font-weight: 900;
}
.achievement-level-desc {
  font-size: 0.82rem;
  color: var(--text-dim);
  text-align: center;
  max-width: 280px;
  line-height: 1.4;
}
.achievement-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  min-width: 0;
}
.achievement-stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 8px;
  text-align: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
  min-width: 0;
  overflow: hidden;
}
.stat-card-value {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
}
.stat-card-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 차트 타이틀 */
.achievement-chart-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin: 18px 0 8px 0;
  padding-left: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 단원별 정답률 막대 그래프 */
.achievement-bar-chart {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
  max-width: 100%;
  overflow: hidden;
}
.chart-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  min-width: 0;
}
.chart-bar-label {
  width: 120px;
  min-width: 0;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text);
  text-align: right;
  flex-shrink: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.25;
}
.chart-bar-track {
  flex: 1;
  min-width: 0;
  height: 22px;
  background: var(--surface2);
  border-radius: 11px;
  overflow: hidden;
}
.chart-bar-fill {
  height: 100%;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 8px;
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  transition: width 0.6s ease;
  min-width: 0;
  overflow: hidden;
}

/* 난이도별 정답률 */
.achievement-difficulty-bars {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
  max-width: 100%;
  overflow: hidden;
}
.difficulty-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  min-width: 0;
}
.difficulty-bar-label {
  width: 90px;
  min-width: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--gold, #f59e0b);
  flex-shrink: 0;
  letter-spacing: 0.5px;
}
.difficulty-bar-track {
  flex: 1;
  min-width: 0;
  height: 22px;
  background: var(--surface2);
  border-radius: 11px;
  overflow: hidden;
}
.difficulty-bar-fill {
  height: 100%;
  border-radius: 11px;
  display: flex;
  align-items: center;
  padding-left: 8px;
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  transition: width 0.6s ease;
  min-width: 0;
}

/* 기초 vs 심화 비교 */
.achievement-compare-chart {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
  max-width: 100%;
  overflow: hidden;
}
.compare-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  min-width: 0;
}
.compare-label {
  width: 120px;
  min-width: 0;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text);
  text-align: right;
  flex-shrink: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.25;
}
.compare-bars {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.compare-bar-wrap {
  height: 14px;
  background: var(--surface2);
  border-radius: 7px;
  overflow: hidden;
}
.compare-bar {
  height: 100%;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 6px;
  font-size: 0.6rem;
  font-weight: 700;
  color: #fff;
  transition: width 0.6s ease;
  overflow: hidden;
}
.basic-bar { background: linear-gradient(90deg, #64B5F6, #2196F3); }
.adv-bar { background: linear-gradient(90deg, #FF8A65, #FF5722); }
.compare-legend {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 8px;
  font-size: 0.75rem;
  color: var(--text-dim);
}
.compare-legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
}
.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.basic-dot { background: #2196F3; }
.adv-dot { background: #FF5722; }

/* 상세 테이블 */
.achievement-level-legend {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin: -4px 0 10px 0;
  line-height: 1.4;
  word-break: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
}

.achievement-table-wrap {
  background: var(--surface2);
  border-radius: 12px;
  padding: 8px;
  border: 1px solid var(--border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  width: 100%;
}
.achievement-table {
  width: 100%;
  min-width: 280px;
  border-collapse: collapse;
  font-size: 0.8rem;
  table-layout: fixed;
}
.achievement-table th {
  background: var(--surface);
  padding: 10px 8px;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  border-bottom: 2px solid var(--border);
  vertical-align: middle;
}
.achievement-table th:first-child,
.achievement-table td:first-child {
  text-align: left;
  padding-left: 10px;
  width: 36%;
  max-width: 160px;
}
.achievement-table td {
  padding: 10px 8px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
.achievement-table td:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.achievement-table tr:hover {
  background: rgba(88, 204, 2, 0.06);
}

/* 취약 단원 알림 */
.achievement-weak-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 100%;
  overflow: hidden;
}
.weak-chapter-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 75, 75, 0.1);
  border-radius: 12px;
  padding: 12px;
  border-left: 4px solid #F44336;
  min-width: 0;
  overflow: hidden;
}
.weak-chapter-icon {
  font-size: 1.5rem;
}
.weak-chapter-info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}
.weak-chapter-name {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text);
}
.weak-chapter-detail {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 2px;
}
.weak-chapter-rate {
  font-size: 1.3rem;
  font-weight: 900;
}

/* 성장 추이 그래프 */
.growth-chart {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}
.growth-chart-inner {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  min-height: 140px;
  padding-bottom: 4px;
}
.growth-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 32px;
}
.growth-bar {
  width: 100%;
  max-width: 28px;
  border-radius: 6px 6px 2px 2px;
  transition: height 0.6s ease;
  min-height: 4px;
}
.growth-val {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-dim);
  margin-top: 3px;
}
.growth-label {
  font-size: 0.6rem;
  color: var(--text-dim);
  margin-top: 1px;
}

/* ═══ 펫 이미지 공통 ═══ */
.pet-img {
  object-fit: contain;
  image-rendering: auto;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  /* 큰 흰 배경 제거 - 눈 부분에만 작은 원 2개 적용 (::before, ::after) */
}

/* 펫 선택 모달 이미지 */
.pet-choice-img {
  width: 64px;
  height: 64px;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.15));
  transition: transform 0.2s ease;
}
.pet-option:hover .pet-choice-img,
.pet-option.selected .pet-choice-img {
  transform: scale(1.12);
}

/* 서식지 펫 이미지 */
.habitat-pet-img {
  width: 120px;
  height: 120px;
  filter: drop-shadow(0 8px 24px rgba(0,0,0,0.4));
  position: relative;
  z-index: 1;
}
/* 펫룸 전설(4단계) 이미지 1.4배 확대 */
.habitat-pet-img-legendary {
  width: 168px !important;
  height: 168px !important;
}

/* 펫 이미지 공통 */

/* 펫 카드 (코스 목록) 이미지 */
.pet-emoji .pet-img {
  width: 52px;
  height: 52px;
}

/* 배틀 HUD 펫 이미지 (경쟁 대전 캐릭터 3배 확대) */
.battle-pet-emoji .pet-img {
  width: 120px;
  height: 120px;
}

/* 배틀 인트로 아바타 이미지 */
.battle-pet-with-acc .pet-img { display: block; }
.ranked-intro-avatar .pet-img,
.ranked-intro-my .pet-img {
  width: 64px;
  height: 64px;
}

/* 매칭 상대 이미지 */
.matched-pet-emoji .pet-img {
  width: 60px;
  height: 60px;
}

/* 배틀 결과 이미지 (경쟁 대전 3배 확대) */
.battle-result-avatar .pet-img {
  width: 100px;
  height: 100px;
}

/* 상대 결과 오버레이 */
.opp-result-pet .pet-img {
  width: 44px;
  height: 44px;
}

/* 진화 이미지 */
.evolve-pet-img {
  filter: drop-shadow(0 4px 16px rgba(255,255,255,0.5));
}

/* 모바일 */
@media (max-width: 600px) {
  .pet-choice-img { width: 52px; height: 52px; }
  .habitat-pet-img { width: 84px; height: 84px; }
  .habitat-pet-img-legendary { width: 118px !important; height: 118px !important; }
  .pet-emoji .pet-img { width: 44px; height: 44px; }
  .battle-pet-emoji .pet-img { width: 96px; height: 96px; }
  .ranked-intro-avatar .pet-img,
  .ranked-intro-my .pet-img { width: 52px; height: 52px; }
}

/* ═══════════════════════════════════════════════════════════
   배경 이펙트 애니메이션 시스템
   ═══════════════════════════════════════════════════════════ */
.bg-fx {
  position: absolute;
  pointer-events: none;
  z-index: 1;
  will-change: transform, opacity;
}

/* ── 떨어지는 이펙트 (fall): 캔디, 눈, 벚꽃, 낙엽 등 ── */
.fx-candy-fall, .fx-petal, .fx-snow, .fx-autumn-leaf, .fx-rainbow-fall {
  top: -8%;
  animation: fxFall 6s linear infinite;
  opacity: 0.85;
}
@keyframes fxFall {
  0%   { transform: translateY(0) rotate(0deg) scale(1); opacity: 0; }
  5%   { opacity: 0.9; }
  50%  { transform: translateY(160px) rotate(180deg) scale(0.95); opacity: 0.85; }
  95%  { opacity: 0.6; }
  100% { transform: translateY(340px) rotate(360deg) scale(0.8); opacity: 0; }
}
/* 눈은 좌우로 흔들리며 떨어짐 */
.fx-snow {
  animation: fxSnowFall 7s ease-in-out infinite;
}
@keyframes fxSnowFall {
  0%   { transform: translateY(0) translateX(0) rotate(0deg); opacity: 0; }
  5%   { opacity: 1; }
  25%  { transform: translateY(80px) translateX(15px) rotate(90deg); }
  50%  { transform: translateY(170px) translateX(-10px) rotate(180deg); opacity: 0.9; }
  75%  { transform: translateY(260px) translateX(12px) rotate(270deg); }
  100% { transform: translateY(350px) translateX(-5px) rotate(360deg); opacity: 0; }
}
/* 벚꽃은 좌우로 날리며 내려옴 */
.fx-petal {
  animation: fxPetalFall 8s ease-in-out infinite;
}
@keyframes fxPetalFall {
  0%   { transform: translateY(0) translateX(0) rotate(0deg) scale(1); opacity: 0; }
  5%   { opacity: 0.9; }
  30%  { transform: translateY(90px) translateX(30px) rotate(120deg) scale(0.95); }
  60%  { transform: translateY(200px) translateX(-20px) rotate(240deg) scale(0.9); opacity: 0.8; }
  100% { transform: translateY(340px) translateX(10px) rotate(360deg) scale(0.7); opacity: 0; }
}
/* 단풍은 천천히 흔들리며 */
.fx-autumn-leaf {
  animation: fxAutumnFall 9s ease-in-out infinite;
}
@keyframes fxAutumnFall {
  0%   { transform: translateY(0) translateX(0) rotate(0deg); opacity: 0; }
  8%   { opacity: 0.9; }
  25%  { transform: translateY(60px) translateX(25px) rotate(60deg); }
  50%  { transform: translateY(150px) translateX(-30px) rotate(180deg); }
  75%  { transform: translateY(250px) translateX(20px) rotate(280deg); opacity: 0.7; }
  100% { transform: translateY(340px) translateX(-10px) rotate(360deg); opacity: 0; }
}

/* ── 올라오는 이펙트 (rise): 거품, 불씨 ── */
.fx-bubble, .fx-ember {
  bottom: 10%;
  animation: fxRise 5s ease-in-out infinite;
}
@keyframes fxRise {
  0%   { transform: translateY(0) translateX(0) scale(0.5); opacity: 0; }
  10%  { opacity: 0.8; transform: translateY(-20px) scale(0.7); }
  50%  { transform: translateY(-140px) translateX(10px) scale(1); opacity: 0.9; }
  80%  { opacity: 0.5; }
  100% { transform: translateY(-280px) translateX(-5px) scale(1.2); opacity: 0; }
}
.fx-bubble { animation-name: fxBubbleRise; }
@keyframes fxBubbleRise {
  0%   { transform: translateY(0) translateX(0) scale(0.3); opacity: 0; }
  10%  { opacity: 0.7; }
  30%  { transform: translateY(-80px) translateX(8px) scale(0.6); }
  60%  { transform: translateY(-180px) translateX(-12px) scale(0.9); opacity: 0.6; }
  100% { transform: translateY(-300px) translateX(5px) scale(1.1); opacity: 0; }
}

/* ── 떠다니는 이펙트 (float): 나뭇잎, 구름, 유령 등 ── */
.fx-leaf, .fx-ghost, .fx-cloud, .fx-bird, .fx-smoke, .fx-wave {
  animation: fxFloat 8s ease-in-out infinite;
}
@keyframes fxFloat {
  0%   { transform: translate(0, 0) rotate(0deg); opacity: 0.7; }
  25%  { transform: translate(20px, -15px) rotate(5deg); opacity: 0.9; }
  50%  { transform: translate(-15px, 10px) rotate(-3deg); opacity: 0.8; }
  75%  { transform: translate(10px, -20px) rotate(8deg); opacity: 0.9; }
  100% { transform: translate(0, 0) rotate(0deg); opacity: 0.7; }
}
/* 구름은 천천히 수평 이동 (크기·속도는 인라인으로 개별 지정) */
.fx-cloud {
  top: 10%;
  animation: fxCloudDrift ease-in-out infinite;
  opacity: 0.6;
}
@keyframes fxCloudDrift {
  0%   { transform: translateX(-20px); opacity: 0.4; }
  50%  { transform: translateX(40px); opacity: 0.7; }
  100% { transform: translateX(-20px); opacity: 0.4; }
}
/* 새는 좌우로 날아다님 */
.fx-bird {
  top: 20%;
  animation: fxBirdFly 10s ease-in-out infinite;
}
@keyframes fxBirdFly {
  0%   { transform: translateX(-30px) translateY(0) scaleX(1); }
  25%  { transform: translateX(60px) translateY(-10px) scaleX(1); }
  50%  { transform: translateX(120px) translateY(5px) scaleX(-1); }
  75%  { transform: translateX(40px) translateY(-15px) scaleX(-1); }
  100% { transform: translateX(-30px) translateY(0) scaleX(1); }
}
/* 유령은 위아래 + 페이드 */
.fx-ghost {
  animation: fxGhostFloat 6s ease-in-out infinite;
}
@keyframes fxGhostFloat {
  0%   { transform: translateY(0) translateX(0) scale(1); opacity: 0.3; }
  25%  { transform: translateY(-25px) translateX(15px) scale(1.05); opacity: 0.8; }
  50%  { transform: translateY(-10px) translateX(-10px) scale(1); opacity: 0.6; }
  75%  { transform: translateY(-30px) translateX(20px) scale(1.08); opacity: 0.9; }
  100% { transform: translateY(0) translateX(0) scale(1); opacity: 0.3; }
}
/* 연기는 위로 퍼짐 */
.fx-smoke {
  animation: fxSmoke 7s ease-out infinite;
  opacity: 0.4;
}
@keyframes fxSmoke {
  0%   { transform: translateY(0) scale(0.8); opacity: 0.5; }
  50%  { transform: translateY(-60px) scale(1.5); opacity: 0.3; }
  100% { transform: translateY(-120px) scale(2); opacity: 0; }
}

/* ── 반짝이는 이펙트 (twinkle / glow): 별, 반딧불이 등 ── */
.fx-star-twinkle, .fx-firefly, .fx-sparkle-candy, .fx-rainbow-sparkle, .fx-ice-sparkle, .fx-nebula {
  animation: fxTwinkle 3s ease-in-out infinite;
}
@keyframes fxTwinkle {
  0%, 100% { opacity: 0.2; transform: scale(0.7); }
  50%      { opacity: 1; transform: scale(1.2); }
}
/* 반딧불이는 위치도 움직임 */
.fx-firefly {
  animation: fxFirefly 5s ease-in-out infinite;
}
@keyframes fxFirefly {
  0%   { opacity: 0.1; transform: translate(0, 0) scale(0.5); }
  20%  { opacity: 0.9; transform: translate(10px, -8px) scale(1); }
  40%  { opacity: 0.3; transform: translate(-5px, 5px) scale(0.6); }
  60%  { opacity: 1; transform: translate(15px, -12px) scale(1.1); }
  80%  { opacity: 0.4; transform: translate(-8px, 3px) scale(0.7); }
  100% { opacity: 0.1; transform: translate(0, 0) scale(0.5); }
}
/* 성운 / 네뷸라 */
.fx-nebula {
  animation: fxNebula 8s ease-in-out infinite;
  font-size: 2rem !important;
  filter: blur(4px);
}
@keyframes fxNebula {
  0%, 100% { opacity: 0.15; transform: scale(1); }
  50%      { opacity: 0.4; transform: scale(1.5); }
}
/* 캠프파이어 */
.fx-campfire {
  bottom: 15%;
  animation: fxCampfire 2s ease-in-out infinite;
}
@keyframes fxCampfire {
  0%, 100% { opacity: 0.6; transform: scale(0.9) translateY(0); }
  25%  { opacity: 1; transform: scale(1.1) translateY(-3px); }
  50%  { opacity: 0.8; transform: scale(1) translateY(-1px); }
  75%  { opacity: 1; transform: scale(1.15) translateY(-4px); }
}
/* 사악한 눈 */
.fx-evil-eye {
  animation: fxEvilEye 4s ease-in-out infinite;
}
@keyframes fxEvilEye {
  0%, 100% { opacity: 0; transform: scale(0.8); }
  30%  { opacity: 0; }
  40%  { opacity: 0.9; transform: scale(1); }
  60%  { opacity: 0.9; transform: scale(1.05); }
  70%  { opacity: 0; }
}
/* 태양 */
.fx-sun {
  top: 5% !important;
  left: 80% !important;
  font-size: 12.5rem !important;
  animation: fxSun 6s ease-in-out infinite;
}
@keyframes fxSun {
  0%, 100% { transform: scale(1) rotate(0deg); filter: drop-shadow(0 0 12px rgba(255,200,0,0.6)); }
  50%      { transform: scale(1.1) rotate(10deg); filter: drop-shadow(0 0 24px rgba(255,200,0,0.9)); }
}

/* ── 유성 (shoot) ── */
.fx-shooting-star {
  top: 5%;
  animation: fxShoot 6s linear infinite;
  opacity: 0;
}
@keyframes fxShoot {
  0%   { transform: translate(0, 0) rotate(-30deg) scale(0.5); opacity: 0; }
  8%   { opacity: 1; transform: translate(20px, 10px) rotate(-30deg) scale(1); }
  15%  { opacity: 0.8; transform: translate(120px, 60px) rotate(-30deg) scale(0.8); }
  20%  { opacity: 0; transform: translate(200px, 100px) rotate(-30deg) scale(0.3); }
  100% { opacity: 0; transform: translate(200px, 100px) rotate(-30deg) scale(0.3); }
}

/* ── 물고기 헤엄 (swim) ── */
.fx-fish {
  animation: fxSwim 12s ease-in-out infinite;
}
@keyframes fxSwim {
  0%   { transform: translateX(-40px) translateY(0) scaleX(1); opacity: 0.7; }
  20%  { transform: translateX(30px) translateY(-10px) scaleX(1); opacity: 0.9; }
  40%  { transform: translateX(100px) translateY(5px) scaleX(1); opacity: 0.8; }
  50%  { transform: translateX(130px) translateY(0) scaleX(-1); }
  70%  { transform: translateX(60px) translateY(-15px) scaleX(-1); opacity: 0.9; }
  90%  { transform: translateX(-20px) translateY(8px) scaleX(-1); opacity: 0.7; }
  100% { transform: translateX(-40px) translateY(0) scaleX(1); opacity: 0.7; }
}

/* ── 행성 궤도 (orbit) ── */
.fx-planet {
  animation: fxOrbit 20s linear infinite;
  font-size: 1.8rem !important;
}
@keyframes fxOrbit {
  0%   { transform: rotate(0deg) translateX(60px) rotate(0deg) scale(0.8); }
  50%  { transform: rotate(180deg) translateX(60px) rotate(-180deg) scale(1.2); }
  100% { transform: rotate(360deg) translateX(60px) rotate(-360deg) scale(0.8); }
}

/* ── 달 / 로켓 / 화산 등 고정 장식 흔들림 ── */
.fx-moon {
  animation: fxMoonGlow 4s ease-in-out infinite;
  filter: drop-shadow(0 0 16px rgba(255,255,200,0.5));
}
@keyframes fxMoonGlow {
  0%, 100% { filter: drop-shadow(0 0 12px rgba(255,255,200,0.4)); transform: scale(1); }
  50%      { filter: drop-shadow(0 0 24px rgba(255,255,200,0.8)); transform: scale(1.05); }
}
.fx-rocket {
  animation: fxRocket 3s ease-in-out infinite;
}
@keyframes fxRocket {
  0%, 100% { transform: rotate(-45deg) translateY(0); }
  50%      { transform: rotate(-45deg) translateY(-8px); }
}
.fx-volcano {
  transform: translateX(-50%);
  animation: fxVolcanoGlow 2s ease-in-out infinite;
}
@keyframes fxVolcanoGlow {
  0%, 100% { filter: drop-shadow(0 4px 12px rgba(255,69,0,0.4)); }
  50%      { filter: drop-shadow(0 4px 24px rgba(255,69,0,0.8)); }
}
.fx-snowman {
  animation: fxSnowmanBob 3s ease-in-out infinite;
}
@keyframes fxSnowmanBob {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-3px) rotate(2deg); }
}
.fx-candy-pole {
  animation: fxCandySpin 8s linear infinite;
}
@keyframes fxCandySpin {
  0%   { transform: rotate(var(--rot, 0deg)); }
  50%  { transform: rotate(calc(var(--rot, 0deg) + 10deg)); }
  100% { transform: rotate(var(--rot, 0deg)); }
}
.fx-tree {
  opacity: 0.6;
  animation: fxTreeSway 6s ease-in-out infinite;
}
@keyframes fxTreeSway {
  0%, 100% { transform: rotate(0deg); }
  25%  { transform: rotate(2deg); }
  75%  { transform: rotate(-2deg); }
}
.fx-coral {
  animation: fxCoralSway 5s ease-in-out infinite;
  opacity: 0.7;
}
@keyframes fxCoralSway {
  0%, 100% { transform: rotate(0deg) scale(1); }
  50%      { transform: rotate(3deg) scale(1.05); }
}
.fx-web {
  opacity: 0.35;
  font-size: 2.5rem !important;
  animation: fxWebSway 8s ease-in-out infinite;
}
@keyframes fxWebSway {
  0%, 100% { transform: rotate(0deg); opacity: 0.3; }
  50%      { transform: rotate(3deg); opacity: 0.5; }
}
.fx-wave {
  bottom: 20%;
  font-size: 1.5rem !important;
  animation: fxWave 4s ease-in-out infinite;
  opacity: 0.5;
}
@keyframes fxWave {
  0%, 100% { transform: translateX(0) scaleX(1); opacity: 0.3; }
  50%      { transform: translateX(20px) scaleX(1.2); opacity: 0.6; }
}

/* 상점 아이템 설명 */
.shop-item-desc {
  font-size: 0.7rem;
  color: #999;
  margin-top: 2px;
  line-height: 1.3;
}

/* ══════════════════════════════════════════════════════════
   AI 종합 분석
   ══════════════════════════════════════════════════════════ */

/* ── 분석 섹션 + 버튼 ── */
.ai-analysis-section {
  margin-bottom: 18px;
}
.ai-analysis-btn {
  width: 100%;
  padding: 14px 0;
  font-size: 1.05rem;
  font-weight: 800;
  border: none;
  border-radius: var(--radius-sm, 12px);
  color: #fff;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 4px 14px rgba(102, 126, 234, 0.35);
  letter-spacing: 0.02em;
  position: relative;
  z-index: 2;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.ai-analysis-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}
.ai-analysis-btn:active {
  transform: translateY(0);
}
.ai-analysis-usage {
  display: block;
  font-size: 0.68rem;
  font-weight: 500;
  opacity: 0.8;
  margin-top: 2px;
  letter-spacing: 0;
}
.ai-analysis-btn.ai-btn-disabled {
  background: linear-gradient(135deg, #555 0%, #444 100%);
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.65;
}
.ai-analysis-btn.ai-btn-disabled:hover {
  transform: none;
  box-shadow: none;
}
.ai-analysis-tier-note {
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-dim, #aaa);
  margin-top: 6px;
  line-height: 1.4;
}
.ai-analysis-tier-note b {
  color: #a78bfa;
  font-weight: 700;
}

/* ── 분석 애니메이션 ── */
.ai-analysis-anim {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 20px;
  gap: 16px;
}
.ai-anim-icon {
  font-size: 3rem;
  animation: aiSpin 2s ease-in-out infinite;
}
@keyframes aiSpin {
  0%   { transform: rotate(0deg) scale(1); }
  25%  { transform: rotate(15deg) scale(1.1); }
  50%  { transform: rotate(0deg) scale(1); }
  75%  { transform: rotate(-15deg) scale(1.1); }
  100% { transform: rotate(0deg) scale(1); }
}
.ai-anim-msg {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text, #333);
  transition: opacity 0.2s ease;
  text-align: center;
  min-height: 1.4em;
}
.ai-anim-progress {
  width: 80%;
  max-width: 260px;
  height: 6px;
  background: var(--surface2, #e8e8e8);
  border-radius: 3px;
  overflow: hidden;
}
.ai-anim-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #667eea, #764ba2);
  border-radius: 3px;
}

/* ── 분석 결과 컨테이너 ── */
.ai-analysis-result {
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: fadeIn 0.5s ease;
  width: 100%;
}

/* 이미지 저장용 로고 (result 내부) – 평소 숨김, 캡처 시만 표시 */
.ai-result-logo {
  text-align: center;
  padding: 40px 0 4px;
  display: none;
}
.ai-result-logo.show-for-capture {
  display: block;
}
.ai-result-logo-img {
  max-width: 700px;
  width: 90%;
  height: auto;
  object-fit: contain;
  transform: scale(1.3);
  transform-origin: center center;
}

/* ── 섹션 카드 (공통) ── */
.ai-section-card {
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e0e0e0);
  border-radius: 14px;
  padding: 16px 3%;
  width: 100%;
  box-sizing: border-box;
}
.ai-section-title {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text, #333);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--border, #e8e8e8);
}

/* ── (1) 종합 성적표 ── */
.ai-grade-card {
  background: linear-gradient(135deg, #1a1d3a 0%, #2a1f3a 100%);
  padding: 16px 3%;
}
.ai-grade-main {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 8px 0;
}
.ai-gauge-wrap {
  flex-shrink: 0;
}
.ai-gauge-svg {
  width: 110px;
  height: 110px;
}
.ai-grade-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ai-level-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  width: fit-content;
}
.ai-grade-detail {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text, #555);
}
.ai-grade-sub {
  font-size: 0.75rem;
  color: var(--sub, #888);
}

/* ── 실제실력 / 최근실력 이중 라벨 ── */
.ai-dual-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text, #555);
  margin: 14px 0 8px 0;
  display: flex;
  align-items: center;
  gap: 4px;
}
.ai-dual-label:first-of-type {
  margin-top: 0;
}
.ai-dual-sub {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--sub, #999);
}
.ai-dual-latest {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px dashed var(--border, #e0e0e0);
}
.ai-improvement {
  font-size: 0.75rem;
  font-weight: 700;
  margin-top: 2px;
  padding: 2px 8px;
  border-radius: 10px;
  display: inline-block;
}

/* ── (2) 기초 vs 심화 ── */
.ai-basic-adv {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ai-ba-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 0;
}
.ai-ba-label {
  width: 36px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text, #555);
  text-align: right;
}
.ai-ba-bar-track {
  flex: 1;
  height: 20px;
  background: var(--surface2, #f0f0f0);
  border-radius: 10px;
  overflow: hidden;
}
.ai-ba-bar {
  height: 100%;
  border-radius: 10px;
  transition: width 0.8s ease;
}
.ai-ba-basic {
  background: linear-gradient(90deg, #64B5F6, #2196F3);
}
.ai-ba-adv {
  background: linear-gradient(90deg, #FF8A65, #FF5722);
}
.ai-ba-val {
  width: 40px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text, #555);
  text-align: right;
}
.ai-ba-comment {
  font-size: 0.78rem;
  color: var(--sub, #777);
  text-align: center;
  margin-top: 4px;
  font-style: italic;
}

/* 난이도별 정답률 (AI 분석) */
.ai-difficulty-bars { margin-top: 8px; }
.ai-diff-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  min-width: 0;
}
.ai-diff-label {
  width: 80px;
  font-size: 0.9rem;
  color: var(--gold, #f59e0b);
  font-weight: 600;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}
.ai-diff-track {
  flex: 1;
  min-width: 0;
  height: 18px;
  background: var(--surface2);
  border-radius: 9px;
  overflow: hidden;
}
.ai-diff-fill {
  height: 100%;
  border-radius: 9px;
  display: flex;
  align-items: center;
  padding-left: 6px;
  font-size: 0.68rem;
  font-weight: 700;
  color: #fff;
  transition: width 0.6s ease;
}
.ai-diff-meta {
  width: 48px;
  font-size: 0.72rem;
  color: var(--text-dim);
  flex-shrink: 0;
}

/* ── (3) 강점 / 약점 ── */
.ai-sw-group {
  margin-bottom: 10px;
}
.ai-sw-group:last-child {
  margin-bottom: 0;
}
.ai-sw-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--sub, #666);
  margin-bottom: 6px;
}
.ai-sw-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 6px;
}
.ai-strength-item {
  background: rgba(76, 175, 80, 0.08);
}
.ai-weakness-item {
  background: rgba(244, 67, 54, 0.08);
}
.ai-sw-icon {
  font-size: 1rem;
  flex-shrink: 0;
}
.ai-sw-name {
  flex: 1;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text, #444);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ai-sw-rate {
  font-size: 0.85rem;
  font-weight: 800;
  flex-shrink: 0;
}
.ai-sw-empty {
  font-size: 0.8rem;
  color: var(--sub, #999);
  text-align: center;
  padding: 12px 0;
}

/* ── (4) 학습 습관 ── */
.ai-habit-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.ai-habit-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--surface2, #f5f5f5);
  border-radius: 10px;
  padding: 18px 12px;
  gap: 4px;
  min-height: 80px;
  justify-content: center;
}
.ai-habit-icon {
  font-size: 1.3rem;
}
.ai-habit-val {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text, #333);
}
.ai-habit-label {
  font-size: 0.7rem;
  color: var(--sub, #888);
}

/* ── (4-1-1) 내 아이 현재 위치 (MR) ── */
.ai-mr-card {
  background: linear-gradient(145deg, rgba(37, 99, 235, 0.08) 0%, rgba(59, 130, 246, 0.04) 50%, rgba(37, 99, 235, 0.06) 100%);
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 14px;
  overflow: hidden;
}
.ai-mr-card .ai-section-title {
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(37, 99, 235, 0.12);
  margin-bottom: 0;
}
.ai-mr-body {
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.ai-mr-score-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 20px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 12px;
  border: 1px solid rgba(37, 99, 235, 0.1);
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.06);
}
.ai-mr-score-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted, #64748b);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.ai-mr-score-val {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--primary, #2563eb);
  letter-spacing: -0.03em;
  line-height: 1.1;
  text-shadow: 0 1px 2px rgba(37, 99, 235, 0.15);
}
.ai-mr-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}
.ai-mr-badge {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text, #334155);
  background: var(--surface2, #f1f5f9);
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  white-space: nowrap;
}
.ai-mr-badge-rank {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.2) 0%, rgba(245, 158, 11, 0.1) 100%);
  border-color: rgba(245, 158, 11, 0.25);
  color: #b45309;
}
.ai-mr-badge-top {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.12) 0%, rgba(59, 130, 246, 0.08) 100%);
  border-color: rgba(37, 99, 235, 0.2);
  color: var(--primary, #2563eb);
}
.ai-mr-growth-row {
  text-align: center;
}
.ai-mr-growth {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
}
.ai-mr-growth.ai-change-up { color: #15803d; background: rgba(22, 163, 74, 0.14); border: 1px solid rgba(22, 163, 74, 0.2); }
.ai-mr-growth.ai-change-down { color: #b91c1c; background: rgba(220, 38, 38, 0.1); border: 1px solid rgba(220, 38, 38, 0.15); }

/* ── (5) 성장 추이 ── */
.ai-growth-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 140px;
  padding: 0 6px;
}
.ai-growth-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
}
.ai-growth-bar {
  width: 80%;
  max-width: 32px;
  border-radius: 4px 4px 0 0;
  transition: height 0.6s ease;
}
.ai-growth-val {
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--text, #555);
  margin-top: 2px;
}
.ai-growth-label {
  font-size: 0.55rem;
  color: var(--sub, #999);
}
.ai-growth-summary {
  text-align: center;
  font-size: 0.78rem;
  font-weight: 600;
  margin-top: 8px;
  padding: 6px 10px;
  border-radius: 8px;
}

/* ── (6) 이전 분석 대비 ── */
.ai-prev-date {
  font-size: 0.72rem;
  color: var(--sub, #999);
  margin-bottom: 10px;
}
.ai-change-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ai-change-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--surface2, #f5f5f5);
  border-radius: 8px;
}
.ai-change-label {
  flex: 1;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text, #555);
}
.ai-change-now {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text, #333);
  min-width: 48px;
  text-align: right;
}
.ai-change-diff {
  font-size: 0.75rem;
  font-weight: 700;
  min-width: 72px;
  text-align: right;
}
.ai-change-up {
  color: #4CAF50;
  background: rgba(76, 175, 80, 0.08);
}
.ai-change-down {
  color: #F44336;
  background: rgba(244, 67, 54, 0.08);
}
.ai-change-same {
  color: var(--sub, #888);
}

/* ── (7) 서버 순위 플레이스홀더 ── */
.ai-rank-placeholder {
  opacity: 0.7;
}
.ai-rank-coming {
  text-align: center;
  font-size: 0.85rem;
  color: var(--sub, #999);
  padding: 16px 0;
}

/* ── (8) 전체 종합평가 ── */
.ai-overall-card {
  background: linear-gradient(135deg, #1a2a3a 0%, #162230 100%);
  border: 1.5px solid #2a4a5a;
}
.ai-overall-wrap {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
}
.ai-overall-gauge {
  flex-shrink: 0;
}
.ai-overall-svg {
  width: 130px;
  height: 130px;
  display: block;
}
.ai-overall-details {
  flex: 1;
  min-width: 160px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ai-overall-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ai-overall-label {
  font-size: 13px;
  color: #ccc;
  width: 80px;
  flex-shrink: 0;
  white-space: nowrap;
}
.ai-overall-bar-track {
  flex: 1;
  height: 14px;
  background: #1e2e36;
  border-radius: 7px;
  overflow: hidden;
  min-width: 60px;
}
.ai-overall-bar {
  height: 100%;
  border-radius: 7px;
  transition: width 0.8s ease;
}
.ai-overall-val {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  width: 42px;
  text-align: right;
  flex-shrink: 0;
}
.ai-overall-msg {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 12px 16px;
  background: rgba(255,255,255,0.04);
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.08);
}
.ai-overall-icon {
  font-size: 28px;
  flex-shrink: 0;
}
.ai-overall-text {
  font-size: 14px;
  color: #ddd;
  line-height: 1.5;
}

@media (max-width: 420px) {
  .ai-overall-wrap {
    flex-direction: column;
    gap: 14px;
  }
  .ai-overall-svg {
    width: 110px;
    height: 110px;
  }
  .ai-overall-label {
    width: 70px;
    font-size: 12px;
  }
  .ai-overall-val {
    font-size: 12px;
  }
  .ai-overall-text {
    font-size: 13px;
  }
}

/* ── (9) AI 종합 코멘트 ── */
.ai-comment-box {
  background: linear-gradient(135deg, #1b2e1b 0%, #1e2d1a 100%);
  border: 1px solid #2e5a2e;
  border-radius: 14px;
  padding: 16px 3%;
  width: 100%;
  box-sizing: border-box;
}
.ai-comment-title {
  font-size: 0.88rem;
  font-weight: 800;
  color: #66bb6a;
  margin-bottom: 10px;
}
.ai-comment-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ai-comment-item {
  font-size: 0.8rem;
  line-height: 1.5;
  color: #e5e5e5;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  position: relative;
  padding-left: 26px;
}
.ai-comment-item::before {
  content: '💡';
  position: absolute;
  left: 8px;
  top: 10px;
  font-size: 0.72rem;
}

/* ── 분석 오류 ── */
.ai-analysis-error {
  text-align: center;
  color: var(--danger, #F44336);
  padding: 20px;
  font-size: 0.85rem;
  font-weight: 600;
}

/* AI 분석 공유용 워터마크·버튼 */
.ai-analysis-watermark {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px dashed rgba(255, 255, 255, 0.15);
  font-size: 0.75rem;
  color: var(--text-dim);
  text-align: center;
}
.ai-analysis-share-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  margin-bottom: 32px;
  padding-top: 12px;
  flex-wrap: wrap;
}
.ai-share-btn {
  flex: 1;
  min-width: 140px;
  padding: 12px 16px;
  border: none;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.ai-share-btn:active {
  transform: scale(0.98);
}
.ai-share-save {
  background: linear-gradient(135deg, #4CAF50 0%, #388E3C 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(76, 175, 80, 0.35);
}
.ai-share-save:hover {
  box-shadow: 0 4px 12px rgba(76, 175, 80, 0.45);
}
.ai-share-share {
  background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(33, 150, 243, 0.35);
}
.ai-share-share:hover {
  box-shadow: 0 4px 12px rgba(33, 150, 243, 0.45);
}

/* 다크모드 대응 */
[data-theme="dark"] .ai-grade-card {
  background: linear-gradient(135deg, #1a1d3a 0%, #2a1f3a 100%);
}
[data-theme="dark"] .ai-comment-box {
  background: linear-gradient(135deg, #1b2e1b 0%, #1e2d1a 100%);
  border-color: #2e5a2e;
}
[data-theme="dark"] .ai-comment-title {
  color: #66bb6a;
}
[data-theme="dark"] .ai-comment-item {
  color: var(--text, #ddd);
  background: rgba(0, 0, 0, 0.25);
}
[data-theme="dark"] .ai-analysis-btn {
  box-shadow: 0 4px 14px rgba(102, 126, 234, 0.2);
}

/* ── 미니게임 ── */
.minigame-entry-card {
  background: linear-gradient(135deg, #2d1b4e 0%, #1a2d4e 100%) !important;
  border-color: rgba(156, 39, 176, 0.5);
}
.minigame-entry-card:hover {
  box-shadow: 0 4px 20px rgba(156, 39, 176, 0.4);
}

.minigame-lobby {
  max-width: 500px;
  margin: 0 auto;
  padding: 24px 16px;
}
.minigame-lobby-icon {
  font-size: 3rem;
  text-align: center;
  margin-bottom: 8px;
}
.minigame-lobby-title {
  font-size: 1.4rem;
  font-weight: 800;
  text-align: center;
  margin-bottom: 6px;
}
.minigame-lobby-desc {
  font-size: 0.9rem;
  color: var(--sub, #999);
  text-align: center;
  margin-bottom: 20px;
}
.minigame-lobby-warn {
  font-size: 0.85rem;
  color: var(--warning, #ff9800);
  text-align: center;
  margin-bottom: 12px;
}
.minigame-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.minigame-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: var(--surface2, rgba(255,255,255,0.08));
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  cursor: pointer;
  transition: transform 0.15s, background 0.2s;
}
.minigame-item:hover:not(.minigame-disabled) {
  transform: translateY(-2px);
  background: rgba(156, 39, 176, 0.15);
}
.minigame-item.minigame-disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.minigame-item.minigame-item-done {
  opacity: 0.65;
  filter: grayscale(0.5);
  background: rgba(128, 128, 128, 0.12);
}
.minigame-item.minigame-item-done:hover {
  transform: none;
  background: rgba(128, 128, 128, 0.12);
}
.minigame-done-badge {
  font-size: 0.8rem;
  font-weight: 600;
  color: #e53935;
  margin-left: auto;
  white-space: nowrap;
  flex-shrink: 0;
}
.minigame-icon-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}
.minigame-icon {
  font-size: 2rem;
}
.minigame-name {
  font-weight: 700;
  font-size: 0.95rem;
}
.minigame-desc {
  font-size: 0.82rem;
  color: var(--sub, #999);
}
.minigame-reward {
  font-size: 0.9rem;
  color: #ffc107;
}

.minigame-loading,
.minigame-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--sub, #999);
}
.minigame-empty .back-btn {
  margin-top: 16px;
}

.minigame-play {
  padding: 20px;
}
.minigame-progress {
  font-size: 0.88rem;
  color: var(--sub, #999);
  margin-bottom: 12px;
}
.minigame-timer-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}
.minigame-timer {
  font-size: 1.5rem;
  font-weight: 800;
  color: #ff5722;
}
.minigame-question {
  background: var(--surface2, rgba(255,255,255,0.06));
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}
.minigame-stem {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 14px;
}
.minigame-choices {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.minigame-choice {
  padding: 12px 16px;
  background: var(--surface, rgba(255,255,255,0.04));
  border: 2px solid rgba(255,255,255,0.15);
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.98rem;
  transition: background 0.2s, border-color 0.2s;
}
.minigame-choice:hover {
  background: rgba(156, 39, 176, 0.2);
  border-color: rgba(156, 39, 176, 0.5);
}
.minigame-choice.correct {
  border-color: #4caf50;
  background: rgba(76, 175, 80, 0.2);
}
.minigame-choice.wrong {
  border-color: #f44336;
  background: rgba(244, 67, 54, 0.15);
}
.minigame-timeattack .minigame-timer-wrap {
  justify-content: center;
}

.bingo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 20px;
}
.bingo-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  background: var(--surface2, rgba(255,255,255,0.08));
  border: 2px solid rgba(255,255,255,0.15);
  border-radius: 10px;
  transition: all 0.2s;
}
.bingo-cell.bingo-checked {
  background: rgba(76, 175, 80, 0.25);
  border-color: #4caf50;
  color: #4caf50;
}

.minigame-result {
  text-align: center;
  padding: 24px;
}
.minigame-result-timeattack .minigame-result-row {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: center;
  gap: 6px 10px;
  margin-bottom: 20px;
  font-size: clamp(0.8rem, 3.2vw, 1.1rem);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px 0;
}
.minigame-result-timeattack .minigame-result-item,
.minigame-result-timeattack .minigame-result-row .minigame-reward-msg {
  margin: 0;
  white-space: nowrap;
  flex-shrink: 0;
}
.minigame-result-timeattack .minigame-result-sep {
  color: var(--sub, #999);
  flex-shrink: 0;
  user-select: none;
}
.minigame-result-timeattack .minigame-result-row .minigame-reward-msg {
  font-weight: 700;
}
.minigame-reward-msg {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 16px;
}
.minigame-result .back-btn {
  margin-top: 8px;
}

/* ═══ O/X 생존 배틀 ═══ */
.ox-survival-entry-card {
  background: linear-gradient(135deg, #14532d 0%, #166534 100%);
  border-color: #22c55e;
}
.ox-survival-entry-card:hover {
  box-shadow: 0 4px 20px rgba(34,197,94,0.4);
}
.ox-survival-lobby {
  text-align: center;
  padding: 16px 0;
}
.ox-survival-icon-wrap { margin: 12px 0; }
.ox-survival-icon-img { display: block; width: 9.6rem; height: 9.6rem; margin: 0 auto; object-fit: contain; }
.ox-survival-title { font-size: 1.6rem; font-weight: 800; color: #22c55e; margin: 4px 0; }
.ox-survival-desc { color: var(--text-dim); font-size: 0.95rem; margin-bottom: 8px; }
.ox-survival-rule { color: var(--text-dim); font-size: 0.9rem; margin-bottom: 12px; font-weight: 600; }
.ox-survival-info { text-align: left; background: var(--surface); border-radius: 12px; padding: 12px 16px; margin: 12px 0; font-size: 0.9rem; }
.ox-survival-balance { font-weight: 700; margin: 12px 0; }
.ox-pool-status { font-size: 0.9rem; color: var(--text-dim); margin: 8px 0; }
.ox-start-btn {
  background: linear-gradient(135deg, #22c55e, #16a34a) !important;
  border-color: #15803d !important;
  color: #fff !important;
  margin-top: 12px;
}
.ox-warn { font-size: 0.85rem; color: var(--red); margin-top: 4px; }

/* OX 게임 시작 전 로딩 화면 (참가자 모이는 연출) */
.ox-loading-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
}
.ox-loading-bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 50% at 50% 40%, rgba(34,197,94,0.12) 0%, transparent 60%);
  pointer-events: none;
}
.ox-loading-content {
  position: relative;
  text-align: center;
  padding: 2rem;
}
.ox-loading-icon {
  display: block;
  width: 9.6rem;
  height: 9.6rem;
  margin: 0 auto 1rem;
  object-fit: contain;
  animation: ox-loading-icon-pulse 1.5s ease-in-out infinite;
}
@keyframes ox-loading-icon-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.08); opacity: 0.9; }
}
.ox-loading-label {
  color: var(--text-dim);
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
}
.ox-loading-count {
  font-size: 1.75rem;
  font-weight: 800;
  color: #22c55e;
  margin: 0.75rem 0;
  min-height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ox-loading-count.ox-loading-pop {
  animation: ox-loading-pop 0.45s ease-out;
}
@keyframes ox-loading-pop {
  0% { transform: scale(0.85); opacity: 0.5; }
  50% { transform: scale(1.12); }
  100% { transform: scale(1); opacity: 1; }
}
.ox-loading-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 1.25rem;
}
.ox-loading-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  opacity: 0.5;
  animation: ox-loading-dot 1s ease-in-out infinite;
}
.ox-loading-dots span:nth-child(2) { animation-delay: 0.15s; }
.ox-loading-dots span:nth-child(3) { animation-delay: 0.3s; }
.ox-loading-dots.ox-loading-done span {
  opacity: 1;
  animation: none;
}
@keyframes ox-loading-dot {
  0%, 100% { transform: scale(0.8); opacity: 0.4; }
  50% { transform: scale(1.2); opacity: 0.9; }
}

/* 비밀의 장 스토리 모드: 상단 헤더·공지 숨김 */
body.story-mode-active .header { display: none; }
body.story-mode-active .notice-banner { display: none !important; }

/* OX 플레이: 전체 디스플레이 = 아레나 */
body.ox-play-fullscreen .header { display: none; }
body.ox-play-fullscreen .notice-banner { display: none !important; }
body.ox-play-fullscreen .container {
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 0;
}
body.ox-play-fullscreen .container > .ox-survival-play {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.ox-survival-play {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
/* 아레나 = 전체 화면 */
.ox-survival-play .ox-arena {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: var(--surface);
}

/* ── HUD: 아레나 위에 오버레이 ── */
.ox-hud-top {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 10;
  pointer-events: auto;
}
.ox-hud-back {
  background: rgba(0,0,0,0.5);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}
.ox-hud-title {
  background: rgba(0,0,0,0.4);
  color: #fbbf24;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 700;
}
.ox-hud-spectate {
  background: rgba(55,65,81,0.8);
  color: #fbbf24;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 700;
}
/* 탈락 현황: 화면 왼쪽 세로 목록 */
.ox-hud-elim-log {
  position: absolute;
  bottom: 16px;
  left: 8px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 3px;
  pointer-events: none;
  max-height: 50%;
  overflow-y: auto;
}
.ox-elim-row {
  background: rgba(0,0,0,0.5);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 0.7rem;
  line-height: 1.3;
  color: #94a3b8;
  white-space: nowrap;
}
.ox-elim-round {
  color: #f87171;
  font-weight: 700;
  margin-right: 4px;
}
.ox-elim-name {
  color: #cbd5e1;
  margin-right: 4px;
}

/* N번 문제 라운드 애니메이션 */
.ox-round-announce {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.55);
  animation: oxRoundIn 0.5s cubic-bezier(0.34,1.56,0.64,1) forwards;
}
.ox-round-announce-out {
  animation: oxRoundOut 0.4s ease forwards;
}
.ox-round-num {
  font-size: 2.8rem;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 0 20px rgba(59,130,246,0.8), 0 0 40px rgba(59,130,246,0.4), 0 4px 12px rgba(0,0,0,0.5);
  letter-spacing: 2px;
}
@keyframes oxRoundIn {
  0% { opacity: 0; transform: scale(0.5); }
  60% { opacity: 1; transform: scale(1.1); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes oxRoundOut {
  0% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.3); }
}

.ox-hud-timer {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--duo-green);
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
  pointer-events: none;
  transition: color 0.3s, font-size 0.3s, text-shadow 0.3s;
}
.ox-hud-timer.ox-timer-danger {
  color: #ef4444;
  font-size: 3rem;
  text-shadow: 0 0 16px rgba(239,68,68,0.7), 0 0 32px rgba(239,68,68,0.4);
}
.ox-hud-timer.ox-timer-pulse {
  animation: oxTimerPulse 0.4s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes oxTimerPulse {
  0% { transform: translateX(-50%) scale(1); }
  40% { transform: translateX(-50%) scale(1.4); }
  100% { transform: translateX(-50%) scale(1); }
}
.ox-hud-question-wrap {
  position: absolute;
  top: 52px;
  left: 16px;
  right: 16px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ox-hud-difficulty {
  font-size: 0.85rem;
  color: var(--gold, #f59e0b);
  letter-spacing: 1px;
}
.ox-hud-question {
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #fff;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.35;
  pointer-events: none;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
}
.ox-hud-controls {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  pointer-events: auto;
}
/* O/X 배경 영역: 아레나 왼쪽 절반, 오른쪽 절반 */
.ox-zone-bg {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 3rem;
  z-index: 0;
}
.ox-zone-bg-o {
  left: 0;
  background: rgba(34,197,94,0.15);
  border-right: 1px dashed rgba(34,197,94,0.3);
}
.ox-zone-bg-x {
  right: 0;
  background: rgba(239,68,68,0.15);
  border-left: 1px dashed rgba(239,68,68,0.3);
}
.ox-zone-label { opacity: 0.25; font-size: 4rem; pointer-events: none; }
/* 덩굴(파란선): 위에서 아래로 내려옴 */
.ox-vine {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  width: 6px;
  height: 0%;
  background: linear-gradient(180deg, #1e40af 0%, #3b82f6 50%, #1e40af 100%);
  border-radius: 0 0 4px 4px;
  transition: height 0.15s linear;
  z-index: 5;
  pointer-events: none;
  box-shadow: 0 0 12px 2px rgba(59,130,246,0.5);
}
/* 캐릭터들: 아레나 안에서 움직임 */
.ox-arena .ox-players {
  position: absolute;
  inset: 0;
  z-index: 3;
}
/* 방향 버튼: 터치 시 스크롤/드래그 방지 */
.ox-dpad .ox-dir {
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
.ox-player {
  position: absolute;
  transform: translateX(-50%) translateY(50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: left 0.12s ease-out, bottom 0.12s ease-out;
  z-index: 3;
  will-change: left, bottom;
}
.ox-elim-label { font-weight: 700; color: #94a3b8; }
.ox-player-me { border: 3px solid var(--duo-green); border-radius: 12px; padding: 4px; background: rgba(34,197,94,0.1); }
.ox-pet-wrap { display: inline-block; }
.ox-pet-wrap-acc { overflow: visible; }
.ox-pet-wrap-acc .ox-pet-img { display: block; }
.ox-pet-img { width: 48px; height: 48px; border-radius: 8px; }
.ox-nickname { font-size: 0.75rem; font-weight: 700; margin-top: 2px; white-space: nowrap; text-shadow: 0 1px 3px rgba(0,0,0,0.5); color: #fff; display: inline-flex; align-items: center; gap: 2px; }
.ox-nickname .flag-icon { width: 14px; height: 10px; object-fit: cover; vertical-align: middle; }
.ox-player-level { font-size: 0.6rem; margin-top: 2px; color: rgba(255,255,255,0.9); font-weight: 700; text-shadow: 0 1px 2px rgba(0,0,0,0.6); }
.ox-player-title { font-size: 0.6rem; margin-top: 1px; color: #fbbf24; white-space: nowrap; text-shadow: 0 1px 2px rgba(0,0,0,0.6); max-width: 90px; overflow: hidden; text-overflow: ellipsis; }
.ox-player.ox-eliminating {
  animation: oxEliminate 1.2s ease forwards;
}
@keyframes oxEliminate {
  0% { transform: translateX(-50%) scale(1); opacity: 1; }
  50% { transform: translateX(-50%) scale(1.2); opacity: 0.8; }
  100% { transform: translateX(-50%) scale(0); opacity: 0; }
}
.ox-dpad {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.ox-dpad-row {
  display: flex;
  gap: 3px;
  justify-content: center;
}
.ox-dpad .ox-dir {
  width: 48px;
  height: 48px;
  font-size: 1.3rem;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.45);
  color: #fff;
  border: 2px solid rgba(255,255,255,0.2);
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
.ox-dpad .ox-dir:active { background: rgba(255,255,255,0.25); }
.ox-dpad .ox-center { opacity: 0.3; cursor: default; }
.ox-result { text-align: center; padding: 24px; }
.ox-result-icon { font-size: 4rem; margin: 16px 0; }
.ox-result-title { font-size: 1.8rem; font-weight: 800; margin: 8px 0; }
.ox-result-desc { color: var(--text-dim); margin-bottom: 16px; }
.ox-result-stars { font-size: 1.2rem; font-weight: 700; color: var(--gold); margin: 12px 0; }
.ox-result-xp { font-size: 1.1rem; font-weight: 700; color: var(--accent); margin: 8px 0; }

/* 테블릿/짧은 화면: OX 플레이 한 화면에 맞춤 */
@media (max-height: 800px) {
  body.ox-play-fullscreen .container { min-height: 100vh; }
  .ox-hud-top { top: 4px; left: 6px; right: 6px; gap: 6px; }
  .ox-hud-back { padding: 4px 10px; font-size: 0.8rem; }
  .ox-hud-title, .ox-hud-spectate { padding: 3px 8px; font-size: 0.75rem; }
  .ox-hud-timer { top: 4px; font-size: 1.6rem; }
  .ox-hud-timer.ox-timer-danger { font-size: 2.2rem; }
  .ox-hud-question-wrap { top: 38px; left: 10px; right: 10px; }
  .ox-hud-difficulty { font-size: 0.75rem; }
  .ox-hud-question {
    padding: 8px 12px;
    font-size: 0.9rem;
    line-height: 1.3;
    border-radius: 10px;
    -webkit-line-clamp: 3;
    line-clamp: 3;
  }
  .ox-hud-controls { bottom: 10px; }
  .ox-hud-elim-log { bottom: 10px; left: 6px; max-height: 40%; }
  .ox-elim-row { padding: 2px 6px; font-size: 0.65rem; }
  .ox-round-num { font-size: 2rem; }
  .ox-dpad .ox-dir { width: 42px; height: 42px; font-size: 1.15rem; }
  .ox-dpad { gap: 2px; }
  .ox-dpad-row { gap: 2px; }
  .ox-player-me { padding: 2px; border-width: 2px; }
  .ox-pet-img { width: 40px; height: 40px; }
  .ox-nickname { font-size: 0.7rem; }
  .ox-player-level, .ox-player-title { font-size: 0.55rem; }
  .ox-zone-label { font-size: 3rem; }
}
@media (max-height: 600px) {
  .ox-hud-question-wrap { top: 34px; }
  .ox-hud-question { padding: 6px 10px; font-size: 0.85rem; -webkit-line-clamp: 2; line-clamp: 2; }
  .ox-hud-timer { font-size: 1.4rem; }
  .ox-hud-timer.ox-timer-danger { font-size: 1.9rem; }
  .ox-hud-controls { bottom: 6px; }
  .ox-hud-elim-log { bottom: 6px; max-height: 35%; }
  .ox-dpad .ox-dir { width: 38px; height: 38px; font-size: 1rem; }
  .ox-pet-img { width: 36px; height: 36px; }
}

/* ══ 친구 목록 ══ */
.friend-section-label { font-size: 0.82rem; color: #94a3b8; margin: 12px 0 6px; font-weight: 600; }
.friend-row { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: rgba(255,255,255,0.05); border-radius: 10px; margin-bottom: 6px; }
.friend-pending { border-left: 3px solid #f59e0b; }
.friend-name { flex: 1; font-weight: 600; color: #e2e8f0; font-size: 0.95rem; }
.friend-grade { font-size: 0.78rem; color: #64748b; min-width: 24px; }
.online-dot { width: 8px; height: 8px; border-radius: 50%; background: #555; display: inline-block; flex-shrink: 0; }
.online-dot.on { background: #22c55e; box-shadow: 0 0 6px #22c55e; }
.offline-dot { width: 8px; height: 8px; border-radius: 50%; background: #475569; display: inline-block; flex-shrink: 0; }
.friend-action-btn { padding: 4px 10px; border-radius: 6px; border: none; font-size: 0.78rem; font-weight: 600; cursor: pointer; }
.friend-accept-btn { background: #22c55e; color: #fff; }
.friend-reject-btn { background: #475569; color: #fff; }
.friend-battle-btn { background: #3b82f6; color: #fff; }
.friend-remove-btn { background: transparent; color: #64748b; font-size: 0.9rem; padding: 4px 6px; }

/* ══ PvP 룰 선택 / 수락 모달 ══ */
.pvp-rule-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,0.55);
  display: flex; align-items: center; justify-content: center;
  animation: pvpFadeIn 0.2s ease;
}
@keyframes pvpFadeIn { from { opacity: 0; } to { opacity: 1; } }
.pvp-rule-modal {
  background: #fff; border-radius: 18px; padding: 24px 20px;
  width: 92%; max-width: 360px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
  animation: pvpSlideUp 0.25s ease;
}
@keyframes pvpSlideUp { from { transform: translateY(30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ── PvP 대기 오버레이 (배틀 인트로 스타일) ── */
.pvp-wait-card {
  animation: pvpSlideUp 0.35s ease;
}
.pvp-wait-icon {
  font-size: 3rem;
  margin-bottom: 8px;
  animation: pvpIconFloat 2s ease-in-out infinite;
}
@keyframes pvpIconFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
.pvp-wait-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 20px;
  letter-spacing: -0.5px;
}
.pvp-wait-avatar {
  width: 80px;
  height: 80px;
  margin: 0 auto 8px;
  background: rgba(255,255,255,0.1);
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  animation: pvpAvatarPulse 2s ease-in-out infinite;
}
@keyframes pvpAvatarPulse {
  0%, 100% { border-color: rgba(255,255,255,0.2); box-shadow: 0 0 0 rgba(139,92,246,0); }
  50% { border-color: rgba(139,92,246,0.6); box-shadow: 0 0 20px rgba(139,92,246,0.3); }
}
.pvp-wait-name {
  color: rgba(255,255,255,0.8);
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 16px;
}
.pvp-waiting-dots {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 16px 0;
}
.pvp-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #a78bfa;
  animation: pvpDotBounce 1.4s ease-in-out infinite;
}
.pvp-dot:nth-child(2) { animation-delay: 0.2s; }
.pvp-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes pvpDotBounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.3; }
  40% { transform: scale(1.1); opacity: 1; }
}
.pvp-wait-status {
  color: rgba(255,255,255,0.6);
  font-size: 0.82rem;
  margin-bottom: 20px;
}
.pvp-wait-timer {
  position: relative;
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
}
.pvp-timer-ring {
  width: 56px;
  height: 56px;
  transform: rotate(-90deg);
}
.pvp-timer-bg {
  fill: none;
  stroke: rgba(255,255,255,0.1);
  stroke-width: 2.5;
}
.pvp-timer-fill {
  fill: none;
  stroke: #a78bfa;
  stroke-width: 2.5;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s linear;
}
.pvp-timer-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
}
.pvp-wait-cancel {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.7);
  padding: 8px 24px;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.pvp-wait-cancel:hover {
  background: rgba(239,68,68,0.2);
  border-color: rgba(239,68,68,0.4);
  color: #fca5a5;
}
.pvp-rule-title {
  font-size: 1.15rem; font-weight: 700; text-align: center;
  margin-bottom: 16px; color: #1f2937;
}
.pvp-rule-section { margin-bottom: 14px; }
.pvp-rule-label {
  display: block; font-size: 0.82rem; font-weight: 600;
  color: #6b7280; margin-bottom: 6px;
}
.pvp-rule-label small { font-weight: 400; opacity: 0.7; }
.pvp-rule-radios { display: flex; flex-direction: column; gap: 8px; }
.pvp-rule-radio {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 10px 12px; border: 2px solid #e5e7eb; border-radius: 12px;
  cursor: pointer; transition: border-color 0.15s;
}
.pvp-rule-radio:has(input:checked) {
  border-color: #f59e0b; background: #fffbeb;
}
.pvp-rule-radio input[type="radio"] {
  margin-top: 3px; accent-color: #f59e0b;
}
.pvp-rule-radio span {
  font-size: 0.9rem; font-weight: 600; color: #1f2937;
  display: block;
}
.pvp-rule-radio small {
  font-size: 0.75rem; color: #9ca3af; display: block; margin-top: 2px;
}
.pvp-rule-select {
  width: 100%; padding: 10px 12px; border: 2px solid #e5e7eb;
  border-radius: 10px; font-size: 0.9rem; color: #1f2937;
  background: #fff; cursor: pointer;
}
.pvp-rule-select:focus { outline: none; border-color: #f59e0b; }
.pvp-rule-challenger {
  text-align: center; margin-bottom: 14px;
  padding: 12px; background: #f9fafb; border-radius: 12px;
}
.pvp-rule-from-name { font-size: 1.1rem; font-weight: 700; color: #1f2937; }
.pvp-rule-from-grade { font-size: 0.82rem; color: #6b7280; margin-top: 2px; }
.pvp-rule-info {
  background: #f9fafb; border-radius: 10px; padding: 10px 14px; margin-bottom: 12px;
}
.pvp-rule-info-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.88rem; color: #374151;
}
.pvp-rule-info-row strong { color: #d97706; }
.pvp-rule-warning {
  background: #fef3c7; color: #92400e; font-size: 0.8rem;
  padding: 8px 12px; border-radius: 8px; margin-bottom: 12px;
  text-align: center; font-weight: 500;
}
.pvp-rule-buttons {
  display: flex; gap: 10px; margin-top: 4px;
}
.pvp-rule-btn {
  flex: 1; padding: 12px; border: none; border-radius: 12px;
  font-size: 0.95rem; font-weight: 700; cursor: pointer;
  transition: transform 0.1s;
}
.pvp-rule-btn:active { transform: scale(0.96); }
.pvp-rule-btn.cancel {
  background: #f3f4f6; color: #6b7280;
}
.pvp-rule-btn.confirm {
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: #fff;
}

/* ══ PvP 대전 ══ */
.pvp-battle-container { max-width: 500px; margin: 0 auto; padding: 16px; }
.pvp-scoreboard { display: flex; align-items: center; justify-content: center; gap: 16px; margin-bottom: 16px; padding: 16px; background: rgba(255,255,255,0.06); border-radius: 14px; }
.pvp-player { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.pvp-name { font-size: 0.85rem; color: #94a3b8; font-weight: 600; }
.pvp-score { font-size: 2rem; font-weight: 800; color: #fff; }
.pvp-me .pvp-score { color: #58CC02; }
.pvp-opp .pvp-score { color: #ef4444; }
.pvp-vs { font-size: 1.2rem; font-weight: 800; color: #64748b; }
.pvp-progress { text-align: center; margin-bottom: 12px; color: #64748b; font-size: 0.85rem; }
.pvp-question { background: rgba(255,255,255,0.06); border-radius: 14px; padding: 20px; }
.pvp-q-text { font-size: 1.1rem; color: #e2e8f0; margin-bottom: 16px; text-align: center; line-height: 1.6; }
.pvp-options { display: flex; flex-direction: column; gap: 8px; }
.pvp-option-btn { padding: 14px 16px; background: rgba(255,255,255,0.08); border: 2px solid rgba(255,255,255,0.1); border-radius: 10px; color: #e2e8f0; font-size: 1rem; font-weight: 600; cursor: pointer; transition: all 0.15s; text-align: left; }
.pvp-option-btn:active { background: rgba(88,204,2,0.2); border-color: #58CC02; }
.pvp-result { text-align: center; padding: 40px 20px; }
.pvp-result-title { font-size: 2.5rem; font-weight: 800; margin-bottom: 24px; }
.pvp-win .pvp-result-title { color: #58CC02; }
.pvp-lose .pvp-result-title { color: #ef4444; }
.pvp-draw .pvp-result-title { color: #f59e0b; }
.pvp-result-scores { display: flex; align-items: center; justify-content: center; gap: 24px; }
.pvp-result-player { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.pvp-result-score { font-size: 2rem; font-weight: 800; color: #fff; }
.pvp-result-vs { color: #64748b; font-weight: 800; }

/* ── 비밀의 장 스토리 모드 (미스터리·고딕) ── */
body.story-mode-active { background: #060508 !important; }
.story-mode.story-screen-dark {
  background: linear-gradient(180deg, #060508 0%, #0d0a12 30%, #0a0810 70%, #050407 100%);
  color: #e8e4dc;
  min-height: 100vh;
  padding: 24px 20px;
  padding-top: 58px; /* 뒤로가기 버튼(14px+40px) 아래부터 시작해 글씨와 겹치지 않음 */
  box-sizing: border-box;
  font-family: Georgia, "Times New Roman", serif;
}
.story-mode.story-screen-dark .story-page { font-family: inherit; }
/* 첫 문구를 화면 세로 중앙에서 시작하기 위한 스페이서 */
.story-center-spacer {
  transition: height 0.35s ease-out;
  overflow: hidden;
}
.story-page {
  max-width: 540px;
  margin: 0 auto;
  position: relative;
}
.story-page::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 80% 50% at 50% 0%, rgba(88, 28, 135, 0.08) 0%, transparent 60%);
}
.story-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: #d4c4b0;
  margin-bottom: 6px;
  letter-spacing: 0.02em;
  text-shadow: 0 0 24px rgba(139, 92, 246, 0.15);
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  padding-bottom: 12px;
}
.story-sub {
  color: #8b7a6b;
  font-size: 0.9rem;
  margin-bottom: 22px;
  letter-spacing: 0.03em;
  font-style: italic;
}
.story-loading {
  color: #8b7a6b;
  text-align: center;
  padding: 48px 0;
  font-style: italic;
}
.story-season-list, .story-day-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 28px;
}
.story-season-row {
  display: flex;
  align-items: stretch;
  gap: 10px;
  position: relative;
}
.story-season-cleared-stamp {
  position: absolute;
  top: 50%;
  right: 52px;
  transform: translateY(-50%) rotate(-12deg);
  color: #c62828;
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  pointer-events: none;
  z-index: 2;
  opacity: 0.92;
  border: 2px solid #c62828;
  padding: 4px 12px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
}
.story-season-row .story-season-btn {
  flex: 1;
  margin: 0;
}
.story-season-notebook-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 52px;
  padding: 0 12px;
  background: linear-gradient(145deg, rgba(30, 26, 40, 0.95) 0%, rgba(20, 18, 28, 0.98) 100%);
  border: 1px solid rgba(139, 92, 246, 0.35);
  border-radius: 6px;
  color: #d4c4b0;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}
.story-season-notebook-btn:hover {
  background: linear-gradient(145deg, rgba(45, 35, 60, 0.95) 0%, rgba(35, 28, 48, 0.98) 100%);
  border-color: rgba(167, 139, 250, 0.5);
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.2);
}
.story-season-clue-count {
  font-size: 0.85rem;
  font-weight: 700;
  min-width: 1.2em;
  text-align: center;
}
.story-season-btn, .story-day-btn {
  padding: 18px 22px;
  background: linear-gradient(145deg, rgba(30, 26, 40, 0.95) 0%, rgba(20, 18, 28, 0.98) 100%);
  border: 1px solid rgba(139, 92, 246, 0.35);
  border-radius: 6px;
  color: #d4c4b0;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: all 0.25s ease;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.03);
}
.story-day-row {
  position: relative;
}
.story-day-cleared-stamp {
  position: absolute;
  top: 50%;
  right: 16px;
  transform: translateY(-50%) rotate(-12deg);
  color: #c62828;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  pointer-events: none;
  z-index: 2;
  opacity: 0.92;
  border: 2px solid #c62828;
  padding: 4px 10px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
}
.story-day-btn {
  display: block;
  width: 100%;
  text-align: left;
}
.story-day-btn-label { display: block; }
.story-season-btn:hover, .story-day-btn:hover {
  background: linear-gradient(145deg, rgba(45, 35, 60, 0.95) 0%, rgba(35, 28, 48, 0.98) 100%);
  border-color: rgba(167, 139, 250, 0.5);
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.2), 0 2px 12px rgba(0, 0, 0, 0.4);
}
.story-btn {
  display: block;
  width: 100%;
  max-width: 280px;
  margin: 20px auto 0;
  padding: 14px 22px;
  background: linear-gradient(145deg, rgba(45, 35, 55, 0.9) 0%, rgba(30, 25, 40, 0.95) 100%);
  border: 1px solid rgba(139, 92, 246, 0.4);
  border-radius: 6px;
  color: #d4c4b0;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}
.story-btn:hover {
  background: linear-gradient(145deg, rgba(55, 45, 70, 0.95) 0%, rgba(40, 32, 55, 0.98) 100%);
  border-color: rgba(167, 139, 250, 0.5);
  box-shadow: 0 0 16px rgba(139, 92, 246, 0.2);
}
.story-btn-back { max-width: 100%; }
.story-coming-soon {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid rgba(139, 92, 246, 0.2);
  text-align: center;
}
.story-coming-soon-title {
  display: block;
  font-size: 0.95rem;
  font-weight: 700;
  color: #a78bfa;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}
.story-coming-soon-desc {
  display: block;
  font-size: 0.85rem;
  color: #8b7a6b;
  line-height: 1.4;
}
.story-choice-page { padding: 24px 20px; }
.story-choice-caption {
  font-size: 1rem;
  color: #8b7a6b;
  margin-bottom: 20px;
  text-align: center;
}
.story-choice-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.story-narrative-choice-btn {
  display: block;
  width: 100%;
  padding: 16px 20px;
  background: linear-gradient(145deg, rgba(30, 26, 40, 0.95) 0%, rgba(20, 18, 28, 0.98) 100%);
  border: 1px solid rgba(139, 92, 246, 0.35);
  border-radius: 6px;
  color: #d4c4b0;
  font-size: 1rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}
.story-narrative-choice-btn:hover {
  background: linear-gradient(145deg, rgba(45, 35, 60, 0.95) 0%, rgba(35, 28, 48, 0.98) 100%);
  border-color: rgba(167, 139, 250, 0.5);
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.2);
}
.story-text-reveal { margin-bottom: 28px; }
.story-text-block {
  font-size: 1.08rem;
  line-height: 1.75;
  color: #e8e4dc;
  margin-bottom: 18px;
  letter-spacing: 0.01em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}
.story-text-typing { min-height: 1.4em; }
.story-typewriter-cursor {
  display: inline-block;
  color: #c4a77d;
  animation: story-cursor-blink 0.8s step-end infinite;
  margin-left: 2px;
  text-shadow: 0 0 8px rgba(196, 167, 125, 0.5);
}
@keyframes story-cursor-blink {
  50% { opacity: 0; }
}
.story-tap-hint {
  font-size: 0.82rem;
  color: #6b5b4f;
  text-align: center;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  animation: story-tap-pulse 2s ease-in-out infinite;
}
@keyframes story-tap-pulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}
.story-illustration-wrap {
  flex: 1;
  min-height: 60vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow: hidden;
}
.story-illustration-img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  transition: opacity 0.4s ease;
  opacity: 0;
}
.story-page.story-illustration-page {
  max-width: none;
}
.story-illustration-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  height: 100vh;
  width: 100%;
  max-width: 100%;
  padding-top: 0;
  box-sizing: border-box;
}
.story-illustration-page .story-tap-hint {
  flex-shrink: 0;
  margin: 8px 0 4px;
}
.story-illustration-page .story-illustration-wrap {
  flex: 1;
  min-height: 60vh;
  min-width: 0;
}
.story-illustration-img.story-img-visible { opacity: 1 !important; }
.story-illustration-placeholder {
  padding: 48px 24px;
  color: #6b5b4f;
  font-size: 0.95rem;
  text-align: center;
  font-style: italic;
}
/* Mini Deduction: 상황/단서 해석·행동 판단 (Problem 아님) */
.story-deduction-page { padding: 24px 20px; }
.story-deduction-caption {
  font-size: 0.82rem;
  color: #8b7a6b;
  margin-bottom: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.story-deduction-prompt {
  font-size: 1.05rem;
  color: #e2e0d8;
  line-height: 1.6;
  margin-bottom: 20px;
}
.story-deduction-choices {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.story-deduction-btn { min-height: 48px; text-align: left; }
.story-deduction-feedback {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
}
.story-deduction-feedback-ok {
  background: rgba(196, 167, 125, 0.15);
  border: 1px solid rgba(196, 167, 125, 0.4);
  color: #c4a77d;
}
.story-deduction-feedback-hint {
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid rgba(148, 163, 184, 0.3);
  color: #94a3b8;
}

.story-problem-caption {
  font-size: 0.88rem;
  color: #8b7a6b;
  margin-bottom: 14px;
  letter-spacing: 0.05em;
  font-style: italic;
}
.story-problem-context {
  font-size: 1rem;
  color: #e2e0d8;
  margin-bottom: 14px;
  line-height: 1.65;
}
.story-problem-question {
  font-size: 1.05rem;
  font-weight: 700;
  color: #c4a77d;
  margin-top: 6px;
  margin-bottom: 18px;
  line-height: 1.65;
}
.story-problem-step {
  font-size: 1rem;
  color: #e2e0d8;
  margin-bottom: 14px;
  line-height: 1.65;
}
.story-choices-wrap { display: flex; flex-direction: column; gap: 12px; margin: 20px 0; }
.story-choice-btn {
  padding: 16px 20px;
  background: linear-gradient(145deg, rgba(35, 28, 48, 0.9) 0%, rgba(25, 20, 35, 0.95) 100%);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 6px;
  color: #d4c4b0;
  font-size: 1rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
.story-choice-btn:hover {
  background: linear-gradient(145deg, rgba(50, 40, 65, 0.95) 0%, rgba(35, 28, 50, 0.98) 100%);
  border-color: rgba(167, 139, 250, 0.45);
  box-shadow: 0 0 16px rgba(139, 92, 246, 0.15);
}
.story-hint-area { margin-top: 14px; }
.story-question-steps-wrap { margin-top: 10px; padding: 10px 0; border-top: 1px solid rgba(139, 92, 246, 0.2); }
.story-hint-btn {
  padding: 10px 16px;
  background: transparent;
  border: 1px solid rgba(139, 92, 246, 0.4);
  border-radius: 6px;
  color: #a78b6b;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}
.story-hint-btn:hover { border-color: rgba(167, 139, 250, 0.5); color: #c4a77d; }
.story-hint-text { margin-left: 10px; color: #c4b8a8; font-size: 0.9rem; }
/* 비밀의 장 정답 피드백: 단서/추리 컨셉 (앰버·골드, 고풍 테두리) */
.story-feedback-ok-wrap {
  margin-top: 16px;
  padding: 14px 18px;
  background: linear-gradient(135deg, rgba(30, 27, 46, 0.95) 0%, rgba(45, 38, 64, 0.9) 100%);
  border: 1px solid rgba(196, 167, 125, 0.5);
  border-radius: 10px;
  box-shadow: inset 0 1px 0 rgba(196, 167, 125, 0.15), 0 0 20px rgba(196, 167, 125, 0.12);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  animation: storyFeedbackReveal 0.45s ease;
}
@keyframes storyFeedbackReveal {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
.story-feedback-ok-icon { font-size: 1.4rem; opacity: 0.9; }
.story-feedback-ok {
  color: #e8dcc8;
  font-weight: 600;
  font-size: 1.05rem;
  margin: 0;
  text-shadow: 0 0 8px rgba(196, 167, 125, 0.2);
}
.story-feedback-stars {
  color: #c4a77d;
  font-weight: 700;
  text-shadow: 0 0 12px rgba(196, 167, 125, 0.35);
}
/* 비밀의 장 정답 피드백을 화면 중앙에 표시 */
#storyProblemFeedback.story-feedback-centered {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 100;
  margin: 0;
  width: auto;
  max-width: 90%;
}
.story-feedback-wrong { color: #fca5a5; margin-top: 14px; }
.story-solution { color: #94a3b8; font-size: 0.9rem; margin-top: 10px; line-height: 1.55; font-style: italic; }
.story-wrong-confirm-btn {
  display: block;
  margin-top: 16px;
  padding: 10px 24px;
  font-size: 1rem;
  font-weight: 600;
  color: #1e1b2e;
  background: linear-gradient(145deg, #c4a77d 0%, #b8956a 100%);
  border: 1px solid rgba(196, 167, 125, 0.5);
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}
.story-wrong-confirm-btn:hover { filter: brightness(1.1); }
.story-wrong-confirm-btn:active { transform: scale(0.98); }
.story-ending-page { display: flex; flex-direction: column; overflow-y: auto; max-height: 100vh; }
.story-ending-back-btn { flex-shrink: 0; margin-bottom: 16px; }
.story-ending-text { font-size: 1.08rem; line-height: 1.75; color: #e2e0d8; margin-bottom: 24px; flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.story-ending-typing { white-space: pre-line; }
.story-stars-summary { font-size: 1.12rem; font-weight: 700; color: #c4a77d; margin-bottom: 24px; text-shadow: 0 0 16px rgba(196, 167, 125, 0.25); }
.story-entry-card { background: linear-gradient(135deg, #1e1b2e 0%, #2d2640 100%); border-color: rgba(124, 58, 237, 0.4); }
.story-entry-card:hover { border-color: rgba(124, 58, 237, 0.7); }

/* Day 선택 후 타이틀 화면: 검정 배경 + Day N (흐림 → 선명 → 지지직 후 사라짐) */
.story-day-title-screen {
  position: fixed;
  inset: 0;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.story-day-title-text {
  font-size: clamp(2rem, 8vw, 3.5rem);
  font-weight: 700;
  color: #e8e4dc;
  opacity: 0.35;
  filter: blur(10px);
  transition: opacity 0.6s ease-out, filter 0.6s ease-out;
  letter-spacing: 0.08em;
}
.story-day-title-text.story-day-title-visible {
  opacity: 1;
  filter: blur(0);
  animation: storyDayTitleGlitch 0.6s ease-in-out infinite;
}
.story-day-title-text.story-day-title-intro.story-day-title-visible {
  animation: none;
}
.story-day-title-text.story-day-title-out {
  opacity: 0;
  animation: none;
  transition: opacity 0.7s ease-out;
}
@keyframes storyDayTitleGlitch {
  0%, 100% { transform: translate(0, 0) skewX(0); }
  15% { transform: translate(-2px, 1px) skewX(-0.5deg); }
  30% { transform: translate(2px, -1px) skewX(0.5deg); }
  45% { transform: translate(-1px, -1px) skewX(0.3deg); }
  60% { transform: translate(1px, 1px) skewX(-0.3deg); }
  75% { transform: translate(-1px, 0) skewX(0); }
  90% { transform: translate(1px, 0) skewX(-0.2deg); }
}
.story-day-title-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  opacity: 0.35;
  filter: blur(10px);
  transition: opacity 0.6s ease-out, filter 0.6s ease-out;
}
.story-day-title-wrap.story-day-title-visible {
  opacity: 1;
  filter: blur(0);
}
.story-day-title-wrap.story-day-title-out {
  opacity: 0;
  transition: opacity 0.7s ease-out;
}
.story-day-title-season {
  font-size: clamp(0.9rem, 3vw, 1.1rem);
  color: #a78b6b;
  letter-spacing: 0.04em;
  opacity: 0.9;
}
.story-day-title-day {
  font-size: clamp(1rem, 4vw, 1.35rem);
  color: #c4a77d;
  font-weight: 600;
  letter-spacing: 0.03em;
}

/* 시즌 버튼 클릭 시 화면 전환: 흐려지며 Day 목록으로 */
.story-mode.story-fade-out {
  opacity: 0;
  filter: blur(10px);
  transition: opacity 0.4s ease-out, filter 0.4s ease-out;
  pointer-events: none;
}
.story-mode.story-fade-in {
  opacity: 0;
}
.story-mode.story-fade-in.story-fade-in-visible {
  opacity: 1;
  transition: opacity 0.35s ease-out;
}

/* 스토리 모드 뒤로가기 버튼 (상단 좌측) */
.story-back-btn {
  position: fixed;
  left: 12px;
  top: 14px;
  z-index: 800;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(145deg, rgba(25, 20, 35, 0.95) 0%, rgba(15, 12, 22, 0.98) 100%);
  border: 1px solid rgba(139, 92, 246, 0.4);
  color: #d4c4b0;
  font-size: 1.2rem;
  cursor: pointer;
  line-height: 1;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4), 0 0 12px rgba(139, 92, 246, 0.1);
  transition: all 0.2s ease;
}
.story-back-btn:hover {
  background: linear-gradient(145deg, rgba(40, 32, 55, 0.98) 0%, rgba(30, 24, 45, 0.98) 100%);
  border-color: rgba(167, 139, 250, 0.5);
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.2);
}

/* ── 비밀의 장: 조사 노트 FAB + 단서 선택창 (우선 적용) ──────── */
.story-clue-fab {
  position: fixed;
  right: 16px;
  top: 14px;
  z-index: 900;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(145deg, rgba(35, 25, 50, 0.98) 0%, rgba(22, 18, 35, 0.98) 100%) !important;
  border: 1px solid rgba(139, 92, 246, 0.5) !important;
  color: #e2d5c0 !important;
  font-size: 1.4rem;
  cursor: pointer;
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.5), 0 0 20px rgba(139, 92, 246, 0.2), inset 0 1px 0 rgba(167, 139, 250, 0.08);
  transition: all 0.2s ease;
}
.story-clue-fab:hover {
  border-color: rgba(167, 139, 250, 0.65) !important;
  box-shadow: 0 0 28px rgba(139, 92, 246, 0.3);
  color: #e8dcc8 !important;
}

/* 단서 선택창(조사 노트) 모달 — 비밀의 장 전용 */
.story-clue-notebook-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(8, 5, 15, 0.94) !important;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12px 20px 48px;
  box-sizing: border-box;
  overflow-y: auto;
}
.story-clue-notebook-overlay .story-clue-notebook-modal {
  background: linear-gradient(180deg, #1e162a 0%, #16121f 45%, #0f0c16 100%) !important;
  border-radius: 12px;
  max-width: 420px;
  width: 100%;
  max-height: calc(100vh - 60px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(100, 80, 130, 0.5) !important;
  box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.25), 0 24px 56px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(167, 139, 250, 0.08);
}
.story-clue-notebook-overlay .story-clue-notebook-title {
  font-size: 1.15rem;
  color: #e2d5c0 !important;
  padding: 10px 20px 8px;
  margin: 0;
  border-bottom: none;
  letter-spacing: 0.04em;
  font-weight: 700;
  background: rgba(20, 15, 30, 0.6) !important;
}
.story-clue-notebook-overlay .story-clue-notebook-day7-intro {
  margin: 0 20px 4px 20px;
  padding: 6px 14px 8px;
  background: rgba(30, 22, 42, 0.7) !important;
  border-left: 3px solid rgba(139, 92, 246, 0.55);
  border-radius: 0 6px 6px 0;
  font-size: 0.9rem;
  color: #a09080 !important;
  line-height: 1.45;
  border-bottom: 1px solid rgba(100, 80, 130, 0.35);
}
.story-clue-notebook-overlay .story-clue-notebook-empty {
  color: #8b7a6b !important;
  padding: 28px 24px;
  margin: 0;
  font-size: 0.95rem;
  text-align: center;
  font-style: italic;
}
.story-clue-notebook-overlay .story-clue-notebook-tabs {
  display: flex;
  gap: 6px;
  padding: 6px 20px 0;
  border-bottom: 1px solid rgba(100, 80, 130, 0.35);
  background: rgba(18, 14, 26, 0.5) !important;
}
.story-clue-notebook-overlay .story-clue-tab {
  flex: 1;
  padding: 8px 12px;
  font-size: 0.86rem;
  font-weight: 600;
  color: #8b7a6b !important;
  background: transparent !important;
  border: 1px solid transparent;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.story-clue-notebook-overlay .story-clue-tab:hover {
  color: #c4b0a0 !important;
  background: rgba(139, 92, 246, 0.1) !important;
}
.story-clue-notebook-overlay .story-clue-tab.active {
  color: #e2d5c0 !important;
  background: rgba(30, 22, 42, 0.95) !important;
  border-color: rgba(100, 80, 130, 0.45);
  border-bottom-color: transparent;
  margin-bottom: -1px;
}
.story-clue-notebook-overlay .story-clue-notebook-content {
  flex: 1;
  min-height: 240px;
  overflow-y: auto;
  padding: 14px 0 40px;
  background: rgba(15, 12, 22, 0.4) !important;
}
.story-clue-notebook-overlay .story-clue-section {
  padding: 10px 20px 14px;
}
.story-clue-notebook-overlay .story-clue-section-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: #c4b0a0 !important;
  margin: 0 0 10px 0;
  letter-spacing: 0.04em;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(100, 80, 130, 0.3);
}
.story-clue-notebook-overlay .story-clue-section-key .story-clue-section-title { color: #d4b86a !important; }
.story-clue-notebook-overlay .story-clue-section-evidence .story-clue-section-title { color: #a78bfa !important; }
.story-clue-notebook-overlay .story-clue-section .story-clue-notebook-list {
  padding: 0 0 8px 0;
}
.story-clue-notebook-overlay .story-clue-notebook-list {
  list-style: none;
  margin: 0;
  padding: 14px 20px;
  overflow-y: auto;
  flex: 1;
}
.story-clue-notebook-overlay .story-clue-notebook-item {
  background: rgba(38, 28, 52, 0.95) !important;
  border: 1px solid rgba(120, 95, 160, 0.5) !important;
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 16px;
  color: #e2e0d8 !important;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(167, 139, 250, 0.06);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.story-clue-notebook-overlay .story-clue-notebook-item:hover {
  border-color: rgba(139, 92, 246, 0.65) !important;
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.2);
}
.story-clue-notebook-overlay .story-clue-item-title {
  font-weight: 600;
  font-size: 1.06rem;
  color: #e2d5c0 !important;
  margin: 0 0 10px 0;
  line-height: 1.45;
  letter-spacing: 0.02em;
}
.story-clue-notebook-overlay .story-clue-item-desc {
  display: block;
  font-size: 0.95rem;
  color: #8b7a6b !important;
  line-height: 1.6;
  margin: 0 0 8px 0;
}
.story-clue-notebook-overlay .story-clue-item-source {
  display: block;
  font-size: 0.75rem;
  color: #6b5a4b !important;
  margin-top: 4px;
  font-style: italic;
}
.story-clue-notebook-overlay .story-clue-notebook-rewards {
  margin-top: auto;
  margin-right: 20px;
  margin-bottom: 10px;
  margin-left: 20px;
  padding: 10px 14px 12px;
  background: rgba(30, 22, 42, 0.9) !important;
  border: 1px solid rgba(100, 80, 130, 0.4) !important;
  border-radius: 8px;
  flex-shrink: 0;
}
.story-clue-notebook-overlay .story-clue-notebook-rewards-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: #e2d5c0 !important;
  margin: 0 0 6px 0;
  letter-spacing: 0.02em;
}
.story-clue-notebook-overlay .story-clue-notebook-reward-item {
  font-size: 0.8rem;
  color: #a09080 !important;
  padding: 4px 0;
}
.story-clue-notebook-overlay .story-clue-notebook-close {
  flex-shrink: 0;
  margin: 14px 20px 20px !important;
  padding: 14px 22px !important;
  background: linear-gradient(145deg, rgba(55, 35, 80, 0.9) 0%, rgba(45, 28, 70, 0.95) 100%) !important;
  border: 1px solid rgba(139, 92, 246, 0.5) !important;
  color: #e2d5c0 !important;
  font-size: 1rem;
}
.story-clue-notebook-overlay .story-clue-notebook-close:hover {
  border-color: rgba(167, 139, 250, 0.65) !important;
  box-shadow: 0 0 16px rgba(139, 92, 246, 0.25) !important;
}
/* 단서 발견 모달 — 비밀의 장 톤 */
.story-clue-discovery-overlay {
  position: fixed;
  inset: 0;
  z-index: 10500;
  background: rgba(8, 5, 15, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
  animation: storyClueDiscoveryIn 0.3s ease;
}
.story-clue-discovery-overlay.story-clue-discovery-out {
  animation: storyClueDiscoveryOut 0.28s ease forwards;
}
@keyframes storyClueDiscoveryIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes storyClueDiscoveryOut {
  from { opacity: 1; }
  to { opacity: 0; }
}
.story-clue-discovery-card {
  background: linear-gradient(165deg, #1e162a 0%, #252035 50%, #1a1525 100%);
  border: 1px solid rgba(100, 80, 130, 0.5);
  border-radius: 12px;
  padding: 24px 26px;
  max-width: 360px;
  width: 100%;
  box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.15), 0 20px 48px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(167, 139, 250, 0.06);
  animation: storyClueDiscoveryCardIn 0.35s ease;
}
@keyframes storyClueDiscoveryCardIn {
  from { opacity: 0; transform: scale(0.92) translateY(12px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.story-clue-discovery-heading {
  font-size: 0.88rem;
  color: #8b7a6b;
  margin: 0 0 14px 0;
  letter-spacing: 0.04em;
}
.story-clue-discovery-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #e2d5c0;
  margin: 0 0 12px 0;
  line-height: 1.4;
}
.story-clue-discovery-desc {
  font-size: 0.92rem;
  color: #8b7a6b;
  line-height: 1.6;
  margin: 0;
}
.story-clue-discovery-added {
  font-size: 0.84rem;
  color: #7a6b5b;
  margin: 14px 0 0 0;
  font-style: italic;
}
.story-clue-discovery-tap-hint {
  font-size: 0.78rem;
  color: #6b5a4b;
  margin: 16px 0 0 0;
  letter-spacing: 0.04em;
}
.story-clue-notebook-rewards-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.story-clue-notebook-overlay .story-clue-notebook-reward-item:not(:last-child) {
  border-bottom: 1px solid rgba(100, 80, 130, 0.3);
}
.story-clue-reward-icon {
  flex-shrink: 0;
  font-size: 0.9rem;
}

/* 비밀의 장 뒤로가기 확인 팝업 */
.story-confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 11000;
  background: rgba(5, 4, 10, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
  animation: story-confirm-fade-in 0.2s ease-out;
}
@keyframes story-confirm-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
.story-confirm-modal {
  background: linear-gradient(180deg, #1a1625 0%, #120f1a 50%, #0d0a12 100%);
  border: 2px solid rgba(139, 92, 246, 0.4);
  border-radius: 12px;
  max-width: 340px;
  width: 100%;
  padding: 24px 20px;
  box-shadow: 0 0 40px rgba(139, 92, 246, 0.2), 0 20px 50px rgba(0, 0, 0, 0.5);
  animation: story-confirm-scale-in 0.25s ease-out;
}
@keyframes story-confirm-scale-in {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}
.story-confirm-message {
  font-size: 1rem;
  line-height: 1.6;
  color: #e2e0d8;
  text-align: center;
  margin: 0 0 20px 0;
  letter-spacing: 0.02em;
}
.story-confirm-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}
.story-confirm-btn {
  min-width: 100px;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}
.story-confirm-btn-cancel {
  background: rgba(51, 65, 85, 0.8);
  border-color: rgba(71, 85, 105, 0.6);
  color: #c4b8a8;
}
.story-confirm-btn-cancel:hover {
  background: rgba(71, 85, 105, 0.9);
  border-color: rgba(148, 163, 184, 0.4);
}
.story-confirm-btn-ok {
  background: linear-gradient(145deg, rgba(88, 28, 135, 0.6) 0%, rgba(109, 40, 217, 0.5) 100%);
  border-color: rgba(139, 92, 246, 0.6);
  color: #e2e0d8;
}
.story-confirm-btn-ok:hover {
  background: linear-gradient(145deg, rgba(109, 40, 217, 0.7) 0%, rgba(124, 58, 237, 0.6) 100%);
  border-color: rgba(167, 139, 250, 0.7);
  box-shadow: 0 0 16px rgba(139, 92, 246, 0.3);
}

/* ── intro_0 확인 페이지 ──────────────────────── */
.story-intro-confirm-page {
  padding: 32px 24px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
}
.story-intro-confirm-context {
  font-size: 1rem;
  line-height: 1.75;
  color: #c4b8a8;
  text-align: center;
  margin-bottom: 32px;
  white-space: pre-wrap;
}
.story-intro-confirm-btn {
  margin-top: 0;
}

/* ── Day7 최종 추리 보드 (FINAL_DEDUCTION) ──────── */
.story-final-deduction-page {
  padding: 20px 16px 32px;
}
.story-fd-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #e2d5c0;
  text-align: center;
  margin-bottom: 6px;
  letter-spacing: 0.03em;
}
.story-fd-subtitle {
  font-size: 0.82rem;
  color: #8b7a6b;
  text-align: center;
  margin-bottom: 18px;
  line-height: 1.45;
  word-break: keep-all;
  overflow-wrap: break-word;
  white-space: normal;
}
.story-fd-clue-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 18px;
}
.story-fd-clue-card {
  background: rgba(30, 22, 42, 0.85);
  border: 1px solid rgba(100, 80, 130, 0.4);
  border-radius: 10px;
  padding: 12px 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  user-select: none;
}
.story-fd-clue-card:hover {
  border-color: rgba(167, 139, 250, 0.6);
  background: rgba(45, 32, 65, 0.9);
}
.story-fd-clue-card.selected {
  border-color: rgba(167, 139, 250, 0.9);
  background: rgba(55, 35, 80, 0.95);
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.35);
}
.story-fd-clue-card.chained {
  border-color: rgba(251, 191, 36, 0.8);
  background: rgba(50, 40, 20, 0.9);
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.25);
}
.story-fd-clue-card-icon {
  font-size: 1.3rem;
  margin-bottom: 6px;
  display: block;
}
.story-fd-clue-card-title {
  font-size: 0.78rem;
  font-weight: 600;
  color: #d4c4b0;
  line-height: 1.4;
}
.story-fd-clue-card-desc {
  font-size: 0.7rem;
  color: #8b7a6b;
  margin-top: 4px;
  line-height: 1.4;
  word-break: keep-all;
  overflow-wrap: break-word;
  white-space: normal;
  overflow: visible;
}
.story-fd-chain-display {
  background: rgba(20, 15, 30, 0.7);
  border: 1px solid rgba(100, 80, 130, 0.3);
  border-radius: 8px;
  padding: 10px 14px;
  min-height: 44px;
  margin-bottom: 14px;
  font-size: 0.82rem;
  color: #a09080;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  word-break: keep-all;
  overflow-wrap: break-word;
}
.story-fd-chain-tag {
  background: rgba(139, 92, 246, 0.2);
  border: 1px solid rgba(139, 92, 246, 0.4);
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 0.75rem;
  color: #c4b0e0;
}
.story-fd-chain-arrow {
  color: rgba(139, 92, 246, 0.6);
  font-size: 0.9rem;
}
.story-fd-chain-hint {
  font-size: 0.75rem;
  color: #6b5a4b;
  font-style: italic;
}

/* 빈칸 채우기 모드 — 비밀의 장 컨셉 단서 선택 UI */
.story-fd-blanks-page .story-fd-subtitle {
  margin-bottom: 20px;
}
.story-fd-blanks {
  margin-bottom: 22px;
}
.story-fd-blank-row {
  margin-bottom: 14px;
}
.story-fd-blank-label {
  display: block;
  font-size: 0.8rem;
  color: #a09080;
  margin-bottom: 6px;
  line-height: 1.4;
}
.story-fd-blank-select-wrap {
  position: relative;
  width: 100%;
}
.story-fd-blank-select {
  width: 100%;
  max-width: 100%;
  padding: 12px 36px 12px 14px;
  font-size: 0.9rem;
  text-align: left;
  color: #e2d5c0;
  background: rgba(30, 22, 42, 0.95);
  border: 1px solid rgba(100, 80, 130, 0.5);
  border-radius: 10px;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238b7a6b' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.story-fd-blank-select:hover,
.story-fd-blank-select:focus {
  border-color: rgba(167, 139, 250, 0.55);
  outline: none;
  box-shadow: 0 0 14px rgba(139, 92, 246, 0.2);
}
.story-fd-blank-dropdown {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  margin-top: 6px;
  max-height: 280px;
  overflow-y: auto;
  background: linear-gradient(180deg, #1e162a 0%, #16121f 100%);
  border: 1px solid rgba(100, 80, 130, 0.5);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(139, 92, 246, 0.15);
  z-index: 100;
}
.story-fd-blank-dropdown.story-fd-blank-dropdown-open {
  display: block;
}
.story-fd-blank-option {
  display: block;
  width: 100%;
  padding: 12px 14px;
  font-size: 0.88rem;
  text-align: left;
  color: #e2d5c0;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(100, 80, 130, 0.25);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.story-fd-blank-option:last-child {
  border-bottom: none;
}
.story-fd-blank-option:hover,
.story-fd-blank-option:focus {
  background: rgba(139, 92, 246, 0.15);
  color: #e8dcc8;
  outline: none;
}

.story-fd-submit-btn {
  display: block;
  width: 100%;
  max-width: 280px;
  margin: 0 auto;
  padding: 13px 20px;
  background: linear-gradient(145deg, rgba(88, 28, 135, 0.7) 0%, rgba(109, 40, 217, 0.6) 100%);
  border: 1px solid rgba(139, 92, 246, 0.55);
  border-radius: 8px;
  color: #e2d5c0;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: 0.03em;
}
.story-fd-submit-btn:hover:not(:disabled) {
  background: linear-gradient(145deg, rgba(109, 40, 217, 0.8) 0%, rgba(124, 58, 237, 0.7) 100%);
  border-color: rgba(167, 139, 250, 0.7);
  box-shadow: 0 0 16px rgba(139, 92, 246, 0.3);
}
.story-fd-submit-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.story-fd-reset-btn {
  display: block;
  margin: 10px auto 0;
  padding: 7px 18px;
  background: transparent;
  border: 1px solid rgba(100, 80, 130, 0.35);
  border-radius: 6px;
  color: #7a6b5a;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
}
.story-fd-reset-btn:hover {
  border-color: rgba(139, 92, 246, 0.4);
  color: #a09080;
}
.story-fd-result-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 5, 15, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  padding: 24px;
}
.story-fd-result-card {
  background: linear-gradient(145deg, rgba(20, 14, 30, 0.97) 0%, rgba(15, 10, 24, 0.99) 100%);
  border: 1px solid rgba(139, 92, 246, 0.45);
  border-radius: 16px;
  padding: 32px 28px;
  max-width: 380px;
  width: 100%;
  text-align: center;
}
.story-fd-result-grade {
  font-size: 2.2rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  margin-bottom: 10px;
}
.story-fd-result-grade.perfect { color: #fbbf24; }
.story-fd-result-grade.good { color: #a78bfa; }
.story-fd-result-grade.shaky { color: #64748b; }
.story-fd-result-msg {
  font-size: 0.9rem;
  color: #c4b8a8;
  line-height: 1.65;
  margin-bottom: 24px;
}
.story-fd-result-retry-btn {
  display: block;
  width: 100%;
  padding: 12px 20px;
  background: rgba(51, 65, 85, 0.8);
  border: 1px solid rgba(71, 85, 105, 0.6);
  border-radius: 8px;
  color: #c4b8a8;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 10px;
  transition: all 0.2s ease;
}
.story-fd-result-retry-btn:hover {
  background: rgba(71, 85, 105, 0.9);
  border-color: rgba(148, 163, 184, 0.4);
}
.story-fd-result-next-btn {
  display: block;
  width: 100%;
  padding: 12px 20px;
  background: linear-gradient(145deg, rgba(88, 28, 135, 0.6) 0%, rgba(109, 40, 217, 0.5) 100%);
  border: 1px solid rgba(139, 92, 246, 0.6);
  border-radius: 8px;
  color: #e2e0d8;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}
.story-fd-result-next-btn:hover {
  background: linear-gradient(145deg, rgba(109, 40, 217, 0.7) 0%, rgba(124, 58, 237, 0.6) 100%);
  border-color: rgba(167, 139, 250, 0.7);
  box-shadow: 0 0 14px rgba(139, 92, 246, 0.3);
}
