/* css/style.css */
:root {
  --bg-main: #f8f9fa;
  --card-bg: #ffffff;
  --accent-green: #2ecc71;
  --accent-orange: #f39c12;
  --accent-red: #e74c3c;
  --accent-black: #121212;
  --border-color: #eeeeee;
}

html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  font-family: "Pretendard Variable", sans-serif;
}

.wrapper {
  width: 100%;
  max-width: 420px;
  height: 100%;
  display: flex;
  flex-direction: column;
  margin: 0 auto;
  background-color: var(--bg-main);
  overflow: hidden; /* 강제로 스크롤 방지 */
  /* iOS 홈 인디케이터 등 safe area 처리 */
  padding-bottom: env(safe-area-inset-bottom);
  box-sizing: border-box;
}

/* ✅ 광고 및 카피라이트 영역 */
.ad-area {
  min-height: 40px;
  flex-shrink: 0;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}
.ad-tag {
  font-size: 8px;
  color: #ddd;
  letter-spacing: 2px;
  margin-bottom: 2px;
}
.copyright {
  font-size: 9px;
  color: #bbb;
  font-weight: 400;
}

/* ✅ 카드 영역 */
.app-card {
  flex-grow: 1;
  overflow-y: auto;
  min-height: 0;
  margin: 6px 8px;
  padding: 22px 20px;
  background: var(--card-bg);
  border-radius: 14px;
  border: none;
  box-shadow: 0 2px 16px rgba(0,0,0,0.07);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

header h1 {
  font-size: 1.4rem; /* 폰트 축소 */
  font-weight: 900;
  letter-spacing: -1px;
  margin: 0;
  line-height: 1.2;
}
.sub-title {
  font-size: 0.65rem;
  color: #999;
  margin-top: 4px;
  line-height: 1.4;
}

.status-container {
  margin: 4px 0; /* 패딩 증가분을 상쇄하기 위해 마진을 더 줄임 */
  width: 100%;
}
#userTitle {
  font-size: 1.05rem;
  font-weight: 800;
}
.score-bar-bg {
  height: 5px;
  margin: 10px 0;
  border-radius: 3px;
  background: #f0f0f0;
  overflow: hidden;
  position: relative;
}
.score-info {
  font-size: 0.7rem;
  color: #aaa;
  font-weight: 700;
}

.diff-pill-group {
  display: flex;
  background: #f0f0f0;
  border-radius: 10px;
  padding: 4px;
  gap: 3px;
  width: 100%;
  box-sizing: border-box;
}
.diff-btn {
  flex: 1;
  padding: 10px 6px;
  border-radius: 7px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  color: #bbb;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  letter-spacing: 0.03em;
}
.diff-btn .diff-pts {
  font-size: 0.62rem;
  font-weight: 600;
  opacity: 0.7;
}
#btn-easy.active {
  background: white;
  color: var(--accent-green);
  box-shadow: 0 1px 6px rgba(0,0,0,0.07);
}
#btn-normal.active {
  background: white;
  color: var(--accent-orange);
  box-shadow: 0 1px 6px rgba(0,0,0,0.07);
}
#btn-hard.active {
  background: white;
  color: var(--accent-red);
  box-shadow: 0 1px 6px rgba(0,0,0,0.07);
}

.btn-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  width: 100%;
}
.btn-area.roulette {
  flex-direction: row;
}
.btn {
  padding: 14px;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  font-family: inherit;
  overflow: hidden;
  white-space: nowrap;
  width: 100%;
  transition: opacity 0.25s ease, font-size 0.35s ease;
}
.spin-btn {
  background: var(--accent-black);
  color: white;
}
.spin-btn:disabled {
  background: #ccc !important;
  cursor: not-allowed;
}
.start-btn {
  background: var(--accent-red);
  color: white;
  display: block;
  width: 0;
  padding-left: 0;
  padding-right: 0;
  opacity: 0;
  pointer-events: none;
}
.comp-btn {
  background: var(--diff-color, #121212);
  color: white;
  display: none;
}
/* split 애니메이션 */
.btn-area.split .spin-btn {
  width: 50%;
  font-size: 0.82rem;
  padding: 11px;
}
.btn-area.split .start-btn {
  width: 50%;
  padding: 11px;
  font-size: 0.82rem;
  opacity: 1;
  pointer-events: auto;
}
.history-link {
  background: none;
  color: #bbb;
  font-size: 0.8rem;
  padding: 10px;
}

/* ✅ 슬롯 최적화 스타일 복원 (매우 중요) */
.slot-window {
  border-radius: 10px;
  margin: 2px 0;
  background: var(--accent-black);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 0;
}
.slot-window.result {
  background: transparent;
}
.slot-spin-area {
  height: 70px;
  width: 100%;
  overflow: hidden;
  position: relative;
}
.slot-list {
  list-style: none; /* 블릿 제거 */
  padding: 0;
  margin: 0;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%; /* Javascript 제어를 위해 고정 */
  transition: transform 3.8s cubic-bezier(0.1, 0, 0.1, 1); /* 회전 애니메이션 */
}
.slot-item {
  height: 70px; /* slot-window 높이와 일치 */
  line-height: 70px;
  font-size: 1.2rem;
  color: white;
  font-weight: 700;
  text-align: center;
  cursor: default;
  -webkit-user-select: none;
  user-select: none;
}

/* 필터 및 모달 스타일 유지 */
.filter-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 20px;
  width: 100%;
}
.filter-btn {
  padding: 8px 2px;
  border-radius: 7px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid #ddd;
  background: transparent;
  cursor: pointer;
  color: #888;
}
.filter-btn.active {
  background: var(--accent-black);
  color: #fff;
  font-weight: 700;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  opacity: 0;
  transition: 0.3s;
}
.modal-overlay.is-visible {
  opacity: 1;
}
.modal-content {
  background: white;
  width: 85%;
  max-width: 320px;
  padding: 25px 20px;
  border-radius: 25px;
  text-align: center;
  transform: scale(1);
  transition: 0.2s;
  box-sizing: border-box;
}
.modal-btn-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}
.modal-btn {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  background: var(--accent-black);
  color: #fff;
}

.complete-score-fill {
  background: var(--accent-black);
  height: 100%;
  width: 0%;
  transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}
#toast {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.9);
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  z-index: 2100;
  opacity: 0;
  transition: 0.3s;
  pointer-events: none;
}
#toast.show {
  opacity: 1;
}

/* ✅ 모달 전체 배경 (오버레이) */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8); /* 배경을 살짝 더 어둡게 해서 집중도 높임 */
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  opacity: 0;
  transition: opacity 0.2s ease;
}

/* ✅ 모달 본체 */
.modal-content {
  background: white;
  width: 80%;
  max-width: 280px;
  padding: 20px 18px;
  border-radius: 16px;
  text-align: center;
  box-sizing: border-box;
  transform: translateY(24px);
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s ease;
}
.modal-overlay.is-visible .modal-content {
  transform: translateY(0);
  opacity: 1;
}

/* 스피너 회전 애니메이션 (버튼 로딩 상태 등 공통) */
@keyframes btn-spin {
  to { transform: rotate(360deg); }
}


/* SweetAlert2 슬라이드업 애니메이션 */
@keyframes swal-slide-up {
  from { opacity: 0; transform: translateY(28px); }
  to   { opacity: 1; transform: translateY(0); }
}
.swal-slide-up {
  animation: swal-slide-up 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* ✅ 모달 내부 타이틀 & 설명 */
.modal-title {
  font-size: 1rem; /* 70~80% 수준으로 폰트 축소 */
  font-weight: 800;
  margin-bottom: 8px;
  line-height: 1.4;
  letter-spacing: -0.5px;
}

.modal-desc {
  font-size: 0.75rem; /* 설명글 축소 */
  color: #888;
  margin-bottom: 15px;
  line-height: 1.5;
}

/* ✅ 모달 버튼 그룹 & 버튼 */
.modal-btn-group {
  display: flex;
  flex-direction: column;
  gap: 8px; /* 버튼 사이 간격 축소 */
  width: 100%;
}

.modal-btn {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  font-family: inherit;
  background: #f0f0f0;
  color: #555;
}
.modal-btn.btn-primary {
  background: var(--accent-black);
  color: #fff;
}
.modal-btn.btn-secondary {
  background: #f0f0f0;
  color: #aaa;
}

/* ✅ 완료 카드 내부 (이미지 캡처 영역) 축소 */
#captureArea {
  padding: 10px;
  background: #fff;
  border-radius: 10px;
}

#cardUserTitle {
  font-size: 1.1rem !important;
  margin-bottom: 5px;
}
#cardExerciseName {
  font-size: 1.25rem !important;
  line-height: 1.2;
}
.complete-badge {
  font-size: 0.55rem;
  padding: 3px 8px;
  margin-bottom: 8px;
}

/* style.css에 추가하거나 easy.html의 <style>에 추가 */
.back-link {
  text-decoration: none;
  color: #333;
  font-size: 1.1rem;
  display: flex; /* 내부에 아이콘을 중앙 정렬 */
  align-items: center;
  width: 24px; /* 뒤의 빈 div와 크기를 맞춰서 중앙 정렬 유지 */
}

.back-link i {
  display: inline-block; /* 아이콘이 줄바꿈 되지 않도록 설정 */
}
/* ✅ SweetAlert2 Black & White Theme Custom */
.swal2-container {
  z-index: 9999 !important; /* 모달보다 높게 설정 */
}
.swal2-popup {
  border-radius: 14px !important;
  font-family: 'Pretendard Variable', sans-serif !important;
  padding: 1.2rem !important; /* 패딩 감소 */
  width: 320px !important; /* 가독성을 위해 살짝 조절 */
  max-width: 90% !important;
}
.swal2-title {
  font-weight: 900 !important;
  color: #121212 !important;
  font-size: 1.15rem !important;
  letter-spacing: -0.5px !important;
  margin-top: 10px !important;
  word-break: keep-all !important; /* 한글 단어 끊김 방지 */
}
.swal2-html-container {
  color: #666 !important;
  font-size: 0.85rem !important;
  line-height: 1.5 !important;
  margin: 10px 0 !important;
  word-break: keep-all !important; /* 한글 단어 끊김 방지 */
  overflow-wrap: break-word !important;
}
.swal2-actions {
  gap: 8px !important;
  width: 100% !important;
  margin-top: 15px !important;
}
.swal2-styled.swal2-confirm {
  border-radius: 8px !important;
  padding: 12px 16px !important;
  font-weight: 800 !important;
  font-size: 0.85rem !important;
  flex: 1 !important;
  box-shadow: none !important;
  word-break: keep-all !important;
  order: 1 !important;
  /* background/color는 confirmButtonColor 인라인에 위임 */
}
.swal2-styled.swal2-cancel {
  border-radius: 8px !important;
  padding: 12px 16px !important;
  font-weight: 800 !important;
  font-size: 0.85rem !important;
  flex: 1 !important;
  box-shadow: none !important;
  order: 2 !important;
  /* background/color는 cancelButtonColor 인라인에 위임 */
}
.swal2-popup:not(.swal2-toast) .swal2-icon {
  margin: 1.25em auto 0.5em !important;
}

/* Ensure success icon ring and lines look clean */
.swal2-popup:not(.swal2-toast) .swal2-icon.swal2-success {
  border-color: var(--accent-green) !important;
}
.swal2-icon.swal2-success [class^='swal2-success-line'] {
  background-color: var(--accent-green) !important;
}
.swal2-icon.swal2-success .swal2-success-ring {
  border: 4px solid rgba(46, 204, 113, .3) !important;
}
.swal2-icon.swal2-warning {
  border-color: #f39c12 !important;
  color: #f39c12 !important;
}
.swal2-popup.swal2-toast {
  width: 90vw !important;
  max-width: 400px !important;
  min-width: auto !important;
  padding: 1rem 1.25rem !important;
  border-radius: 12px !important;
  box-shadow: 0 4px 20px rgba(0,0,0,0.10) !important;
  border: none !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
}
.swal2-popup.swal2-toast .swal2-title {
  font-size: 1rem !important;
  margin: 0 !important;
  text-align: center !important;
  white-space: normal !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-grow: 0 !important;
}
.swal2-popup.swal2-toast .swal2-icon {
  margin: 0 10px 0 0 !important;
}

/* ✅ UI Utilities */
.hide-scrollbar {
    -ms-overflow-style: none; /* IE and Edge */
    scrollbar-width: none; /* Firefox */
}
.hide-scrollbar::-webkit-scrollbar {
    display: none; /* Chrome, Safari and Opera */
}
.scroll-mask {
    -webkit-mask-image: linear-gradient(to bottom, black 90%, transparent 100%);
    mask-image: linear-gradient(to bottom, black 90%, transparent 100%);
}
