/* ========================================
   모바일 스트룹 훈련 전용 스타일 v1.0.0
   - app.html 나의성장 탭 내 인라인 게임
   - 세로화면(portrait) 최적화
   - 화려한 애니메이션: Radial Burst, Shake, confetti, Count-Up
   - 연속 정답 콤보 배지, 카운트다운 연출
   ======================================== */

/* ========================================
   CSS 변수
   ======================================== */
:root {
  --sm-primary:    #10b981;
  --sm-danger:     #ef4444;
  --sm-warning:    #f59e0b;
  --sm-info:       #3b82f6;
  --sm-purple:     #8b5cf6;
  --sm-gold:       #f59e0b;
  --sm-bg:         #f0fdf4;
  --sm-card:       #ffffff;
  --sm-radius:     20px;
  --sm-shadow:     0 8px 32px rgba(16,185,129,0.13);

  --color-red:    #FF4757;
  --color-blue:   #5352ED;
  --color-yellow: #FFA502;
  --color-green:  #26DE81;
  --color-pink:   #FC427B;
  --color-purple: #A55EEA;
}

/* ========================================
   나의성장 탭 — 뇌훈련 섹션 진입 카드
   ======================================== */

.sm-entry-card {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border-radius: var(--sm-radius);
  padding: 20px;
  margin: 12px 0;
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(16,185,129,0.3);
  position: relative;
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.sm-entry-card:active {
  transform: scale(0.97);
  box-shadow: 0 3px 12px rgba(16,185,129,0.2);
}
.sm-entry-card::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 120px; height: 120px;
  background: rgba(255,255,255,0.1);
  border-radius: 50%;
}
.sm-entry-icon {
  font-size: 44px;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.2));
}
.sm-entry-info { flex: 1; min-width: 0; }
.sm-entry-title {
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
}
.sm-entry-desc {
  font-size: 12px;
  color: rgba(255,255,255,0.85);
  margin-bottom: 8px;
}
.sm-entry-last {
  display: inline-block;
  background: rgba(255,255,255,0.2);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
}
.sm-entry-arrow {
  font-size: 22px;
  color: rgba(255,255,255,0.8);
  flex-shrink: 0;
}

/* ========================================
   전체 게임 오버레이 (app.html 위에 fullscreen)
   ======================================== */

#sm-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: #0f172a;
  flex-direction: column;
  overflow: hidden;
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}
#sm-overlay.active {
  display: flex;
}

/* ========================================
   헤더
   ======================================== */

.sm-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(255,255,255,0.05);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
  height: 56px;
}
.sm-header-back {
  background: rgba(255,255,255,0.1);
  border: none;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 20px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s;
}
.sm-header-back:active { background: rgba(255,255,255,0.2); }

.sm-header-title {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  text-align: center;
}
.sm-header-level {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 20px;
  min-width: 64px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(16,185,129,0.4);
}

/* ========================================
   진행 정보 바
   ======================================== */

.sm-progress-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: rgba(255,255,255,0.04);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}
.sm-progress-trial {
  font-size: 12px;
  color: rgba(255,255,255,0.6);
  font-weight: 600;
}
.sm-progress-score {
  font-size: 14px;
  font-weight: 700;
  color: #10b981;
}
.sm-progress-combo {
  font-size: 12px;
  font-weight: 700;
  color: #f59e0b;
  min-width: 60px;
  text-align: right;
  transition: all 0.2s;
}
.sm-progress-combo.combo-3  { color: #f97316; font-size: 13px; }
.sm-progress-combo.combo-5  { color: #ef4444; font-size: 14px; }
.sm-progress-combo.combo-7  { color: #14b8a6; font-size: 15px; }
.sm-progress-combo.combo-10 { color: #f59e0b; font-size: 15px; animation: sm-badge-pulse 0.5s ease-in-out infinite alternate; }
.sm-progress-combo.combo-15 { color: #a855f7; font-size: 16px; animation: sm-badge-rainbow 0.5s linear infinite; }

/* 4순위: 배지 진화 튕김 */
.sm-progress-combo.badge-levelup {
  animation: sm-badge-bounce 0.55s cubic-bezier(0.36, 0.07, 0.19, 0.97) forwards !important;
}
@keyframes sm-badge-bounce {
  0%   { transform: scale(1); }
  25%  { transform: scale(1.7) rotate(-8deg); }
  50%  { transform: scale(0.85) rotate(5deg); }
  75%  { transform: scale(1.3) rotate(-3deg); }
  100% { transform: scale(1); }
}

/* 3순위: 배지 깨짐 */
.sm-progress-combo.badge-break {
  animation: sm-badge-shatter 0.55s ease-out forwards !important;
}
@keyframes sm-badge-shatter {
  0%   { transform: scale(1);    opacity: 1; }
  30%  { transform: scale(1.4) rotate(10deg); opacity: 1; }
  100% { transform: scale(0) rotate(30deg);   opacity: 0; }
}

@keyframes sm-badge-pulse {
  from { text-shadow: 0 0 6px rgba(59,130,246,0.6); }
  to   { text-shadow: 0 0 18px rgba(59,130,246,1), 0 0 32px rgba(59,130,246,0.5); }
}

/* ========================================
   화면 컨테이너 (스크린들을 감싸는 wrapper)
   ======================================== */

.sm-screens {
  flex: 1;
  position: relative;
  overflow: hidden;
  min-height: 0;
}

.sm-screen {
  display: none;
  flex-direction: column;
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.sm-screen.active {
  display: flex;
}

/* ========================================
   레벨 선택 화면
   ======================================== */

#sm-screen-levels {
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
  background: #0f172a;
}

.sm-levels-title {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  text-align: center;
  margin-bottom: 6px;
}
.sm-levels-subtitle {
  font-size: 12px;
  color: rgba(255,255,255,0.5);
  text-align: center;
  margin-bottom: 20px;
}

/* 이어하기 배너 */
.sm-resume-banner {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 16px;
  display: none;
}
.sm-resume-banner.visible { display: block; }
.sm-resume-banner-title {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
}
.sm-resume-banner-info {
  font-size: 12px;
  color: rgba(255,255,255,0.85);
  margin-bottom: 12px;
}
.sm-resume-btns {
  display: flex;
  gap: 8px;
}
.sm-resume-btn {
  flex: 1;
  padding: 8px;
  border: none;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.sm-resume-btn-yes {
  background: #fff;
  color: #d97706;
}
.sm-resume-btn-no {
  background: rgba(255,255,255,0.2);
  color: #fff;
}

.sm-level-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.sm-level-card {
  background: rgba(255,255,255,0.07);
  border: 1.5px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  padding: 14px 12px;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s, border-color 0.15s;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  overflow: hidden;
}
.sm-level-card:active {
  transform: scale(0.96);
  background: rgba(16,185,129,0.15);
}
.sm-level-card.interrupted {
  border-color: #f59e0b;
  background: rgba(245,158,11,0.1);
}
.sm-level-num {
  font-size: 28px;
  font-weight: 900;
  color: #fff;
  line-height: 1;
  margin-bottom: 2px;
}
.sm-level-name {
  font-size: 13px;
  font-weight: 700;
  color: #10b981;
  margin-bottom: 6px;
}
.sm-level-info {
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  margin-bottom: 4px;
}
.sm-level-target {
  font-size: 10px;
  color: rgba(255,255,255,0.4);
}
.sm-level-badge-interrupted {
  position: absolute;
  top: 8px; right: 8px;
  background: #f59e0b;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 8px;
}
.sm-level-best {
  font-size: 10px;
  color: #f59e0b;
  font-weight: 600;
  margin-top: 4px;
}

/* ========================================
   카운트다운 화면
   ======================================== */

#sm-screen-countdown {
  align-items: center;
  justify-content: center;
  background: #0f172a;
  position: relative;
}

.sm-countdown-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.sm-countdown-level-info {
  font-size: 14px;
  color: rgba(255,255,255,0.6);
  font-weight: 600;
}

.sm-countdown-number {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 80px;
  font-weight: 900;
  color: #fff;
  box-shadow: 0 0 60px rgba(0,0,0,0.5);
  transition: background 0.3s;
  animation: sm-countdown-pulse 0.8s ease-out;
  text-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
.sm-countdown-number.c3 { background: radial-gradient(circle, #ef4444, #b91c1c); }
.sm-countdown-number.c2 { background: radial-gradient(circle, #f59e0b, #b45309); }
.sm-countdown-number.c1 { background: radial-gradient(circle, #10b981, #047857); }
.sm-countdown-number.cgo {
  background: radial-gradient(circle, #10b981, #047857);
  font-size: 52px;
  animation: sm-countdown-go 0.5s ease-out;
}

@keyframes sm-countdown-pulse {
  0%   { transform: scale(1.6); opacity: 0; }
  60%  { transform: scale(0.92); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes sm-countdown-go {
  0%   { transform: scale(0.5); opacity: 0; }
  60%  { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}

.sm-countdown-hint {
  font-size: 13px;
  color: rgba(255,255,255,0.4);
}

/* ========================================
   게임 화면
   ======================================== */

#sm-screen-game {
  background: #0f172a;
  flex-direction: column;
}

/* 타이머 바 */
.sm-timer-wrap {
  padding: 0 16px;
  padding-top: 10px;
  flex-shrink: 0;
}
.sm-timer-bg {
  background: rgba(255,255,255,0.08);
  border-radius: 999px;
  height: 10px;
  overflow: hidden;
  position: relative;
}
.sm-timer-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #10b981, #34d399);
  transition: width 0.1s linear, background 0.3s;
  width: 100%;
}
.sm-timer-fill.warn   { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.sm-timer-fill.danger { background: linear-gradient(90deg, #ef4444, #f87171); }
.sm-timer-fill.danger.pulse {
  animation: sm-timer-pulse 0.3s ease-in-out infinite alternate;
}
@keyframes sm-timer-pulse {
  from { opacity: 1; }
  to   { opacity: 0.5; }
}
.sm-timer-text {
  text-align: right;
  font-size: 11px;
  font-weight: 600;
  color: rgba(255,255,255,0.5);
  margin-top: 4px;
}

/* 문제 영역 */
.sm-question-area {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
  min-height: 140px;
  position: relative;
}

.sm-question-card {
  background: rgba(255,255,255,0.06);
  border: 2px solid rgba(255,255,255,0.1);
  border-radius: 24px;
  width: 100%;
  padding: 24px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 110px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.sm-question-card.correct-flash {
  border-color: #10b981;
  box-shadow: 0 0 20px rgba(16,185,129,0.4), inset 0 0 20px rgba(16,185,129,0.05);
  animation: sm-card-correct 0.25s ease-out;
}
.sm-question-card.wrong-flash {
  border-color: #ef4444;
  box-shadow: 0 0 20px rgba(239,68,68,0.4), inset 0 0 20px rgba(239,68,68,0.05);
}
@keyframes sm-card-correct {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.03); }
  100% { transform: scale(1); }
}

.sm-question-text {
  font-size: 72px;
  font-weight: 900;
  letter-spacing: 4px;
  text-shadow: 0 4px 20px rgba(0,0,0,0.5);
  animation: sm-question-appear 0.2s cubic-bezier(0.34,1.56,0.64,1);
  user-select: none;
  -webkit-user-select: none;
}
@keyframes sm-question-appear {
  0%   { transform: scale(0.3); opacity: 0; }
  100% { transform: scale(1);   opacity: 1; }
}

/* 버튼 영역 */
.sm-buttons-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px 16px;
  min-height: 0;
}

.sm-buttons-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  width: 100%;
  max-width: 360px;
  gap: 10px;
}

.sm-btn {
  border: none;
  border-radius: 18px;
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  cursor: pointer;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-shadow: 0 2px 8px rgba(0,0,0,0.3);
  box-shadow: 0 6px 20px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.2);
  transition: transform 0.1s, box-shadow 0.1s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  position: relative;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}
.sm-buttons-grid.grid-6 .sm-btn {
  height: 68px;
  font-size: 16px;
  border-radius: 14px;
}
.sm-btn:active {
  transform: scale(0.93);
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.sm-btn.explode {
  animation: sm-btn-explode 0.32s ease-out forwards;
}
@keyframes sm-btn-explode {
  0%   { transform: scale(1);    box-shadow: 0 2px 8px rgba(0,0,0,0.2); }
  25%  { transform: scale(1.28); box-shadow: 0 0 40px rgba(255,255,255,0.7), 0 0 18px currentColor; }
  60%  { transform: scale(1.12); box-shadow: 0 0 20px rgba(255,255,255,0.4); }
  100% { transform: scale(0.88); opacity: 0.35; box-shadow: none; }
}

/* 정답 힌트 하이라이트 */
.sm-btn.hint-correct {
  animation: sm-hint-glow 0.7s ease-out;
  box-shadow: 0 0 24px rgba(16,185,129,0.8), 0 6px 20px rgba(0,0,0,0.3);
}
@keyframes sm-hint-glow {
  0%,100% { box-shadow: 0 6px 20px rgba(0,0,0,0.3); }
  40%     { box-shadow: 0 0 30px rgba(16,185,129,0.9), 0 0 60px rgba(16,185,129,0.4); }
}

/* 점수 영역 */
.sm-score-bar {
  display: flex;
  justify-content: space-around;
  padding: 8px 16px;
  background: rgba(255,255,255,0.03);
  border-top: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}
.sm-score-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.sm-score-label {
  font-size: 10px;
  color: rgba(255,255,255,0.4);
  font-weight: 600;
}
.sm-score-value {
  font-size: 16px;
  font-weight: 800;
  color: #fff;
}
.sm-score-value.correct { color: #10b981; }
.sm-score-value.wrong   { color: #ef4444; }

/* ========================================
   결과 화면
   ======================================== */

#sm-screen-result {
  background: #0f172a;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  /* ✅ v2.5.6.135: display는 .sm-screen / .sm-screen.active에 위임
     → display:flex를 여기 선언하면 비활성 상태에도 항상 보여서 검은 화면 버그 발생 */
}

/* ✅ v2.5.6.135: 결과화면이 active일 때만 스크롤 컨테이너로 동작
   .sm-screen.active가 display:flex이므로, 결과화면 전용 flex 설정을 active 상태에만 적용 */
#sm-screen-result.active {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.sm-result-wrap {
  padding: 20px 16px 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  /* ✅ v2.5.6.135: 콘텐츠 높이만큼 스크롤 — flex 부모 안에서 늘어나되 스크롤 가능 */
  flex: none;
  width: 100%;
  box-sizing: border-box;
}

.sm-result-grade-badge {
  font-size: 64px;
  margin-bottom: 8px;
  animation: sm-result-bounce 0.6s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes sm-result-bounce {
  0%   { transform: scale(0) rotate(-20deg); opacity: 0; }
  100% { transform: scale(1) rotate(0deg);   opacity: 1; }
}

.sm-result-title {
  font-size: 26px;
  font-weight: 900;
  color: #fff;
  margin-bottom: 4px;
  text-align: center;
}
.sm-result-subtitle {
  font-size: 13px;
  color: rgba(255,255,255,0.5);
  margin-bottom: 20px;
  text-align: center;
}

.sm-result-stars {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
}
.sm-result-star {
  font-size: 28px;
  opacity: 0;
  transform: scale(0) rotate(-30deg);
  animation: sm-star-pop 0.4s cubic-bezier(0.34,1.56,0.64,1) forwards;
}
@keyframes sm-star-pop {
  to { opacity: 1; transform: scale(1) rotate(0deg); }
}

.sm-result-stats-card {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px;
  padding: 20px;
  width: 100%;
  margin-bottom: 16px;
}
.sm-result-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.sm-result-stat-row:last-child { border-bottom: none; }
.sm-result-stat-label {
  font-size: 13px;
  color: rgba(255,255,255,0.5);
  font-weight: 500;
}
.sm-result-stat-value {
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  transition: all 0.05s;
}
.sm-result-stat-value.counting { color: #10b981; }

.sm-result-grade-card {
  background: rgba(255,255,255,0.06);
  border-radius: 20px;
  padding: 16px 20px;
  width: 100%;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sm-result-grade-label {
  font-size: 13px;
  color: rgba(255,255,255,0.5);
}
.sm-result-grade-value {
  font-size: 22px;
  font-weight: 900;
}
.sm-result-grade-msg {
  font-size: 12px;
  color: rgba(255,255,255,0.6);
  margin-top: 6px;
  text-align: center;
  width: 100%;
}

.sm-result-next-info {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 12px 16px;
  width: 100%;
  margin-bottom: 20px;
  text-align: center;
}
.sm-result-next-label {
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  margin-bottom: 4px;
}
.sm-result-next-value {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
}

/* 결과 버튼들 */
.sm-result-btns {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}
.sm-result-btn {
  padding: 16px;
  border: none;
  border-radius: 16px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.1s, opacity 0.1s;
  width: 100%;
}
.sm-result-btn:active { transform: scale(0.97); opacity: 0.85; }
/* 1번: 초록 — 주 행동 (앞으로 나아감) */
.sm-result-btn-primary {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  box-shadow: 0 6px 20px rgba(16,185,129,0.35);
}
/* 2번: 파랑 — 보조 행동 (반복 도전) */
.sm-result-btn-secondary {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
  box-shadow: 0 4px 14px rgba(59,130,246,0.30);
}
/* 3번: 중간 회색 — 종료 행동 (크기 동일, 색으로만 덜 강조) */
.sm-result-btn-complete {
  background: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.75);
  border: 1px solid rgba(255,255,255,0.18);
  font-size: 15px;
  padding: 16px;
}

/* ========================================
   인지훈련 트렌드 카드 (v2.5.6.130)
   결과 화면 하단 — 통계 탭과 동일한 구성
   어두운 배경(#0f172a)에 최적화
   ======================================== */

/* ── 카드 래퍼 ── */
.sm-mini-stats-card {
  width: 100%;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 16px;
  padding: 16px;
  box-sizing: border-box;
  overflow: hidden;
}

/* ── 로딩 ── */
.sm-mini-stats-loading {
  text-align: center;
  font-size: 13px;
  color: rgba(255,255,255,0.45);
  padding: 10px 0;
  animation: sm-pulse 1.2s ease-in-out infinite;
}
@keyframes sm-pulse {
  0%, 100% { opacity: 0.45; }
  50%       { opacity: 1; }
}

/* ── 첫 훈련 완료 케이스 ── */
.sm-mini-stats-first {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 4px 0 2px;
}
.sm-mini-stats-first-emoji  { font-size: 28px; line-height: 1; }
.sm-mini-stats-first-text   { font-size: 15px; font-weight: 700; color: #fff; }
.sm-mini-stats-first-sub    {
  font-size: 12px; color: rgba(255,255,255,0.5);
  text-align: center; line-height: 1.4; margin-bottom: 4px;
}

/* ── 카드 헤더 ── */
.sm-trend-header {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sm-trend-header-icon  { font-size: 16px; line-height: 1; }
.sm-trend-header-title {
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.2px;
}

/* ── 숫자 카드 격자 ── */
.sm-trend-num-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 0;
}
.sm-trend-num-card {
  background: rgba(255,255,255,0.07);
  border-radius: 10px;
  padding: 9px 6px 8px;
  text-align: center;
  border-top-width: 2px; /* color via inline style */
  border-top-style: solid;
}
.sm-trend-num-val {
  font-size: 17px;
  font-weight: 900;
  line-height: 1.1;
  /* color via inline style */
}
.sm-trend-num-label {
  font-size: 10px;
  color: rgba(255,255,255,0.45);
  margin-top: 3px;
}

/* ── 트렌드 메시지 ── */
.sm-trend-msg {
  margin: 12px 0 10px;
  padding: 9px 11px;
  background: rgba(124,58,237,0.18);
  border: 1px solid rgba(124,58,237,0.3);
  border-radius: 9px;
  font-size: 12px;
  color: rgba(255,255,255,0.85);
  line-height: 1.5;
}

/* ── 소제목 ── */
.sm-trend-sub-title {
  font-size: 11px;
  font-weight: 700;
  color: rgba(255,255,255,0.6);
  margin: 12px 0 6px;
}

/* ── 바차트 ── */
.sm-trend-bar-row       { margin-bottom: 8px; }
.sm-trend-bar-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  margin-bottom: 3px;
}
.sm-trend-bar-track {
  background: rgba(255,255,255,0.1);
  border-radius: 99px;
  height: 6px;
  overflow: hidden;
}
.sm-trend-bar-fill {
  height: 6px;
  border-radius: 99px;
  transition: width 0.6s cubic-bezier(0.4,0,0.2,1);
}
.sm-trend-no-data {
  font-size: 12px;
  color: rgba(255,255,255,0.35);
  text-align: center;
  padding: 6px 0;
}

/* ── 이동 버튼 ── */
.sm-mini-stats-goto {
  display: block;
  width: 100%;
  margin-top: 14px;
  padding: 11px;
  background: rgba(124,58,237,0.2);
  border: 1px solid rgba(124,58,237,0.4);
  border-radius: 10px;
  color: #c4b5fd;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s;
  box-sizing: border-box;
}
.sm-mini-stats-goto:active { background: rgba(124,58,237,0.35); }

/* ========================================
   이펙트 레이어
   ======================================== */

#sm-effect-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 4000;
  overflow: hidden;
}

/* Radial Burst (정답) */
.sm-radial-burst {
  position: absolute;
  border-radius: 50%;
  transform: scale(0);
  opacity: 0.8;
  animation: sm-burst 0.4s ease-out forwards;
}
@keyframes sm-burst {
  0%   { transform: scale(0); opacity: 0.8; }
  100% { transform: scale(4); opacity: 0; }
}

/* 경계 펄스 (오답) */
.sm-border-pulse {
  position: fixed;
  inset: 0;
  border: 8px solid #ef4444;
  border-radius: 0;
  opacity: 0;
  animation: sm-border-pulse 0.45s ease-out forwards;
  pointer-events: none;
}
@keyframes sm-border-pulse {
  0%   { opacity: 0.9; box-shadow: inset 0 0 40px rgba(239,68,68,0.6); }
  100% { opacity: 0; box-shadow: inset 0 0 0 rgba(239,68,68,0); }
}

/* 파티클 */
.sm-particle {
  position: absolute;
  border-radius: 50%;
  animation: sm-particle-fly 0.9s ease-out forwards;
}
.sm-particle.star {
  border-radius: 0;
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}
.sm-particle.square {
  border-radius: 3px;
}
@keyframes sm-particle-fly {
  0%   { transform: translate(0,0) scale(1) rotate(0deg); opacity: 1; }
  100% { transform: translate(var(--tx),var(--ty)) scale(0) rotate(var(--rot)); opacity: 0; }
}

/* Shake (오답 화면) */
.sm-shake {
  animation: sm-shake-anim 0.4s ease-out;
}
@keyframes sm-shake-anim {
  0%,100% { transform: translateX(0); }
  15%     { transform: translateX(-9px); }
  30%     { transform: translateX(9px); }
  45%     { transform: translateX(-7px); }
  60%     { transform: translateX(7px); }
  75%     { transform: translateX(-4px); }
  90%     { transform: translateX(4px); }
}

/* 피드백 텍스트 팝업 */
.sm-feedback {
  position: fixed;
  top: 38%;
  left: 50%;
  transform: translateX(-50%) scale(0);
  font-size: 52px;
  font-weight: 900;
  pointer-events: none;
  z-index: 4500;
  text-shadow: 0 4px 16px rgba(0,0,0,0.5);
  animation: sm-feedback-pop 0.7s cubic-bezier(0.34,1.56,0.64,1) forwards;
  white-space: nowrap;
}
@keyframes sm-feedback-pop {
  0%   { transform: translateX(-50%) scale(0); opacity: 0; }
  45%  { transform: translateX(-50%) scale(1.15); opacity: 1; }
  70%  { transform: translateX(-50%) scale(1); opacity: 1; }
  100% { transform: translateX(-50%) translateY(-60px) scale(0.7); opacity: 0; }
}

/* 콤보 텍스트 */
/* ✅ v2.5.6.142: 텍스트 팝업 제거 → 단계별 시각 이펙트 CSS */

/* ── 공통: 테두리 Glow 베이스 ── */
.sm-combo-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 4600;
  border-radius: 0;
  border: 6px solid transparent;
}

/* 단계1: 주황 Glow (3~4연속) */
.combo-glow-orange {
  border-color: #f97316;
  box-shadow: inset 0 0 40px rgba(249,115,22,0.45);
  animation: sm-glow-fade 0.7s ease-out forwards;
}

/* 단계2: 불꽃 Glow (5~9연속) */
.combo-glow-flame {
  border-color: #ef4444;
  box-shadow: inset 0 0 60px rgba(239,68,68,0.5), inset 0 0 120px rgba(249,115,22,0.3);
  animation: sm-glow-flame 0.8s ease-out forwards;
}
@keyframes sm-glow-flame {
  0%   { opacity: 1; }
  60%  { opacity: 1; }
  100% { opacity: 0; }
}

/* ── 콤보 텍스트 팝업 (작은→큰 글씨 페이드아웃) ── */
.sm-combo-text-popup {
  position: fixed;
  left: 50%;
  top: 44%;
  transform: translateX(-50%) translateY(-50%);
  font-size: 58px;
  font-weight: 900;
  letter-spacing: -2px;
  pointer-events: none;
  z-index: 4800;
  white-space: nowrap;
  -webkit-text-stroke: 2px rgba(0,0,0,0.18);
  paint-order: stroke fill;
  animation: sm-combo-text-pop 1.4s cubic-bezier(0.15, 0.8, 0.3, 1) forwards;
}
@keyframes sm-combo-text-pop {
  0%   { transform: translateX(-50%) translateY(-50%) scale(0.08); opacity: 0; }
  12%  { transform: translateX(-50%) translateY(-50%) scale(1.08); opacity: 1; }
  22%  { transform: translateX(-50%) translateY(-50%) scale(0.95); opacity: 1; }
  70%  { transform: translateX(-50%) translateY(-50%) scale(1.0);  opacity: 1; }
  100% { transform: translateX(-50%) translateY(-50%) scale(2.8);  opacity: 0; }
}

/* 정답 클릭 중앙 플래시 */
.sm-correct-flash-center {
  position: fixed;
  width: 200px;
  height: 200px;
  margin-left: -100px;
  margin-top: -100px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.95) 0%, rgba(255,255,220,0.6) 40%, transparent 70%);
  pointer-events: none;
  z-index: 4650;
  animation: sm-center-flash 0.35s ease-out forwards;
}
@keyframes sm-center-flash {
  0%   { transform: scale(0.2); opacity: 1; }
  60%  { transform: scale(1.4); opacity: 0.8; }
  100% { transform: scale(2.2); opacity: 0; }
}
.combo-glow-gold {
  border-color: #f59e0b;
  box-shadow: inset 0 0 80px rgba(245,158,11,0.55), 0 0 0 9999px rgba(245,158,11,0.06);
  animation: sm-glow-flash 0.6s ease-out forwards;
}

/* 단계4: 골드 번쩍 테두리 (10~14연속) */
.combo-glow-blue {
  border-color: #f59e0b;
  border-width: 8px;
  box-shadow: inset 0 0 60px rgba(245,158,11,0.5), inset 0 0 120px rgba(251,191,36,0.3);
  animation: sm-glow-blue 1.2s ease-out forwards;
}
@keyframes sm-glow-blue {
  0%   { opacity: 1; border-color: #f59e0b; }
  30%  { opacity: 1; border-color: #fcd34d; }
  60%  { opacity: 1; border-color: #f59e0b; }
  100% { opacity: 0; }
}

/* 단계3: 청록 테두리 (7~9연속) */
.combo-glow-teal {
  border-color: #14b8a6;
  border-width: 6px;
  box-shadow: inset 0 0 60px rgba(20,184,166,0.45), inset 0 0 100px rgba(45,212,191,0.25);
  animation: sm-glow-teal 1.0s ease-out forwards;
}
@keyframes sm-glow-teal {
  0%   { opacity: 1; border-color: #14b8a6; }
  40%  { opacity: 1; border-color: #2dd4bf; }
  100% { opacity: 0; }
}

/* 단계5: 무지개 테두리 (15연속+) */
.combo-glow-rainbow {
  border-width: 8px;
  border-style: solid;
  border-image: linear-gradient(90deg,#ff4757,#ffa502,#2ed573,#1e90ff,#a55eea,#ff4757) 1;
  box-shadow: inset 0 0 80px rgba(255,255,255,0.1);
  animation: sm-glow-rainbow 1.5s ease-out forwards;
}

/* ── 2순위: 스포트라이트 모드 (7연속+) ── */
.sm-overlay.sm-spotlight::before {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse 70% 60% at 50% 45%, transparent 40%, rgba(0,0,0,0.55) 100%);
  pointer-events: none;
  z-index: 3900;
  animation: sm-spotlight-in 0.6s ease-out forwards;
}
@keyframes sm-spotlight-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── 2순위: 버튼 반짝임 (20연속+) ── */
.sm-btn.sm-btn-sparkle {
  animation: sm-sparkle 0.4s ease-out forwards;
}
@keyframes sm-sparkle {
  0%   { box-shadow: 0 2px 8px rgba(0,0,0,0.2); filter: brightness(1); }
  40%  { box-shadow: 0 0 24px rgba(99,102,241,0.9), 0 0 48px rgba(99,102,241,0.4); filter: brightness(1.5); }
  100% { box-shadow: 0 2px 8px rgba(0,0,0,0.2); filter: brightness(1); }
}

/* ── 2순위: 무지개 배경 (30연속+) ── */
.sm-overlay.sm-rainbow-bg {
  animation: sm-rainbow-bg 1.8s ease-out forwards;
}
@keyframes sm-rainbow-bg {
  0%   { background: #f0fdf4; }
  15%  { background: linear-gradient(135deg, #fef3c7, #fce7f3, #ede9fe); }
  50%  { background: linear-gradient(135deg, #ede9fe, #dbeafe, #d1fae5); }
  85%  { background: linear-gradient(135deg, #d1fae5, #fef3c7, #fce7f3); }
  100% { background: #f0fdf4; }
}

/* ── 3순위: 콤보 브레이크 텍스트 ── */
.sm-combo-break-text {
  position: fixed;
  left: 50%;
  top: 38%;
  transform: translateX(-50%) translateY(-50%);
  font-size: 26px;
  font-weight: 900;
  color: #ef4444;
  text-shadow: 0 0 20px rgba(239,68,68,0.8), 0 2px 8px rgba(0,0,0,0.3);
  pointer-events: none;
  z-index: 4800;
  white-space: nowrap;
  animation: sm-break-pop 1.0s ease-out forwards;
}
@keyframes sm-break-pop {
  0%   { transform: translateX(-50%) translateY(-50%) scale(0.5); opacity: 0; }
  20%  { transform: translateX(-50%) translateY(-50%) scale(1.1); opacity: 1; }
  70%  { transform: translateX(-50%) translateY(-50%) scale(1.0); opacity: 1; }
  100% { transform: translateX(-50%) translateY(-50%) scale(0.8); opacity: 0; }
}

/* ── 5순위: 타이머 콤보 단계별 색상 ── */
.sm-timer-fill.combo-teal   { background: linear-gradient(90deg, #14b8a6, #2dd4bf); }
.sm-timer-fill.combo-gold   { background: linear-gradient(90deg, #f59e0b, #fcd34d); }
.sm-timer-fill.combo-rainbow {
  background: linear-gradient(90deg, #ff4757, #ffa502, #2ed573, #1e90ff, #a55eea);
  background-size: 200% 100%;
  animation: sm-timer-rainbow 1s linear infinite;
}
@keyframes sm-timer-rainbow {
  0%   { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

/* ── 5순위: 타이머 텍스트 박동 ── */
.sm-timer-text.timer-pulse {
  animation: sm-timer-text-pulse 0.6s ease-in-out infinite alternate;
}
@keyframes sm-timer-text-pulse {
  from { transform: scale(1);    color: inherit; }
  to   { transform: scale(1.12); color: #f59e0b; }
}

@keyframes sm-glow-fade {
  0%   { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes sm-glow-flash {
  0%   { opacity: 0.9; }
  40%  { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes sm-glow-rainbow {
  0%   { opacity: 1; }
  70%  { opacity: 1; }
  100% { opacity: 0; }
}

/* ── 단계2: 불꽃 파티클 상승 (5~9연속) ── */
.sm-combo-flame {
  position: fixed;
  bottom: 0;
  pointer-events: none;
  z-index: 4600;
  line-height: 1;
  animation: sm-flame-rise var(--dur, 1s) ease-out forwards;
  transform-origin: center bottom;
}
@keyframes sm-flame-rise {
  0%   { transform: translateY(0) translateX(0) scale(1);   opacity: 1; }
  60%  { opacity: 1; }
  100% { transform: translateY(-70vh) translateX(var(--tx, 0px)) scale(0.4); opacity: 0; }
}

/* ── 단계3: 별 파티클 폭발 (10~14연속) ── */
.sm-combo-star {
  position: fixed;
  pointer-events: none;
  z-index: 4600;
  line-height: 1;
  transform-origin: center;
  animation: sm-star-burst var(--dur, 0.9s) ease-out forwards;
}
@keyframes sm-star-burst {
  0%   { transform: translate(0, 0) scale(1.2); opacity: 1; }
  100% { transform: translate(var(--tx, 0px), var(--ty, -80px)) scale(0); opacity: 0; }
}

@keyframes sm-badge-rainbow {
  0%   { color: #ff4757; }
  25%  { color: #ffa502; }
  50%  { color: #2ed573; }
  75%  { color: #1e90ff; }
  100% { color: #ff4757; }
}

/* ========================================
   confetti (색종이 비 — 우수 등급)
   ======================================== */

/* ── 폭죽 파티클 (smShowConfetti — rAF 물리 시뮬레이션) ──
   위치·회전·투명도는 JS requestAnimationFrame으로 제어 */
.sm-firework-particle {
  position: fixed;
  pointer-events: none;
  z-index: 4700;
  transform-origin: center center;
  will-change: transform, left, top, opacity;
}

/* ── 색종이 낙하 (콤보 이펙트 — 위에서 아래로 비처럼) ── */
.sm-confetti-piece {
  position: fixed;
  top: -18px;
  pointer-events: none;
  z-index: 4600;
  border-radius: 2px;
  animation: sm-confetti-fall linear forwards;
}
@keyframes sm-confetti-fall {
  0%   { transform: translateY(0) translateX(0) rotate(0deg);            opacity: 1; }
  50%  { transform: translateY(50vh) translateX(var(--swing, 0px)) rotate(calc(var(--rot) * 0.5)); opacity: 1; }
  85%  { opacity: 1; }
  100% { transform: translateY(108vh) translateX(calc(var(--swing, 0px) * 1.5)) rotate(var(--rot)); opacity: 0; }
}

/* ========================================
   카운트다운 배경 파티클
   ======================================== */

.sm-bg-ring {
  position: absolute;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.15);
  animation: sm-ring-expand 0.8s ease-out forwards;
}
@keyframes sm-ring-expand {
  0%   { transform: scale(0.4); opacity: 0.8; }
  100% { transform: scale(2.5); opacity: 0; }
}

/* ========================================
   나의성장 탭 — 오늘 훈련 기록 카드
   ======================================== */

.sm-today-record-card {
  background: rgba(16,185,129,0.08);
  border: 1.5px solid rgba(16,185,129,0.25);
  border-radius: 16px;
  padding: 14px 16px;
  margin-top: 12px;
  display: none;
}
.sm-today-record-card.visible { display: block; }
.sm-today-record-title {
  font-size: 13px;
  font-weight: 700;
  color: #10b981;
  margin-bottom: 10px;
}
.sm-today-record-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.sm-today-record-row:last-child { border-bottom: none; }
.sm-today-record-label {
  font-size: 11px;
  color: rgba(255,255,255,0.5);
}
.sm-today-record-value {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}

/* ========================================
   반응형: 화면 높이별 조정
   ======================================== */

/* 작은 폰 (height < 700px) */
@media (max-height: 700px) {
  .sm-question-text  { font-size: 56px; }
  .sm-question-area  { min-height: 100px; }
  .sm-btn            { height: 60px; font-size: 16px; }
  .sm-buttons-grid.grid-6 .sm-btn { height: 54px; font-size: 14px; }
  .sm-result-grade-badge { font-size: 48px; }
  .sm-result-title       { font-size: 22px; }
}

/* 큰 폰 (height > 850px) */
@media (min-height: 851px) {
  .sm-question-text { font-size: 84px; }
  .sm-question-area { min-height: 160px; }
  .sm-btn           { height: 84px; font-size: 20px; }
  .sm-buttons-grid.grid-6 .sm-btn { height: 74px; font-size: 16px; }
}

