/* Pretendard Variable Font */
@font-face {
  font-family: 'Pretendard Variable';
  src: url('./fonts/PretendardVariable.woff2') format('woff2-variations');
  font-weight: 1 1000;
  font-style: normal;
  font-display: swap;
}

/* 기본 설정 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Pretendard Variable', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  text-align: center;
  background: linear-gradient(to bottom, #f9f9ff, #e2ecff);
  color: #333;
  min-height: 100vh;
  box-sizing: border-box;
  overflow-x: hidden;
}
html, body {
  min-height: 120vh;
  overflow-y: auto;
}
.logo-link {
  text-decoration: none;
  color: inherit;
}
h2 {
  font-size: 1.5rem;
  /*margin-bottom: 20px;
  margin-top: 20px;*/
}
main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  box-sizing: border-box;
}

/* 버튼 기본 스타일 */
.btn {
  font-family: 'Gowun Dodum', sans-serif;
  padding: 12px 24px;
  font-size: 1.2rem;
  border: none;
  border-radius: 10px;
  background-color: #4CAF50;
  color: white;
  cursor: pointer;
  transition: background-color 0.3s;
  margin: 8px;
}

.btn:hover:not(:disabled) {
  /*background-color: #45a049;*/
}

.btn:disabled {
  background-color: #999;
  color: #ddd;
  cursor: not-allowed;
}
#click-btn {
  background-color: #ff4e4e;
  color: #fff;
  font-size: 2rem;
  width: 160px;
  height: 160px;
  border: none;
  border-radius: 50%;
  margin: 30px auto;
  transition: transform 0.1s ease, background-color 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

#click-btn:disabled {
  background-color: #ccc;
  color: #888;
  cursor: not-allowed;
}

#click-btn:active {
  transform: scale(0.95);
}
/* 버튼 기본 스타일 */
.btn_rank {
  font-family: 'Gowun Dodum', sans-serif;
  padding: 12px 24px;
  font-size: 1.2rem;
  border: none;
  border-radius: 10px;
  background-color: #4CAF50;
  color: white;
  cursor: pointer;
  transition: background-color 0.3s;
  margin: 1px;
}
/* 결과 텍스트 */
#result {
  font-size: 1.3rem;
  margin-top: 20px;
  font-weight: bold;
  text-align: center;
}

/* 메시지 텍스트 */
#message {
  font-size: 1.1rem;
  margin-bottom: 12px;
  text-align: center;
}
#hearts {
  font-size: 28px;
  margin: 10px 0;
}
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 1rem;
  height: 60px;
  background: #222;
  color: white;
  position: sticky;
  top: 0;
  z-index: 10;
  box-sizing: border-box;
}

header h1 {
  font-size: 1.2rem;
  line-height: 1;
  font-family: 'Jalnan', sans-serif;
  margin: 0;
      position: absolute;
  left: 50%;
  transform: translateX(-50%);
}
header button {
  background: #ff5722;
  color: white;
  border: none;
  padding: 0.3rem 0.7rem;
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
  line-height: 1;
    display: flex;
  gap: 0.5rem;
  margin-left: auto;
}
body.index-page {
  margin: 0;
  padding: 0;
  font-family: 'Pretendard Variable', sans-serif;
  background: #f4f4f4;
  color: #333;
  padding-bottom: 60px; /* ✅ 하단 광고 높이만큼 여백 확보 */
}

.index-page header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 1rem;
  height: 60px;
  background: #222;
  color: white;
  position: sticky;
  top: 0;
  z-index: 10;
  box-sizing: border-box;
}

.index-page header h1 {
  font-size: 1.2rem;
  line-height: 1;
  font-family: 'Jalnan', sans-serif;
  margin: 0;
    position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.index-page header button {
  background: #ff5722;
  color: white;
  border: none;
  padding: 0.3rem 0.7rem;
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
  line-height: 1;
    display: flex;
  gap: 0.5rem;
  margin-left: auto;
}

.index-page .slide-banner-container {
  overflow: hidden;
  position: relative;
}

.index-page .slide-banner {
  display: flex;
  width: 300%;
  transition: transform 0.5s ease-in-out;
}

.index-page .slide-banner img {
  width: 100vw;
  height: 250px;
  object-fit: cover;
  flex-shrink: 0;
}

.index-page .indicator {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
}

.index-page .indicator span {
  font-size: 12px;
  color: #ccc;
  cursor: pointer;
}

.index-page .indicator .active {
  color: white;
}

.index-page .game-section {
  padding: 0.5rem 1rem;
  margin-bottom: 1rem;
  background: #fafafa;
  border-radius: 12px;
}

.index-page .game-section h2 {
  font-size: 1.1rem;
	text-align: left;
	margin-bottom: 10px;
	margin-top: 10px;
}

.index-page .game-slider {
  display: flex;
  overflow-x: auto;
  gap: 0.5rem;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  /*padding: 1rem;*/
  border-radius: 16px;
  scroll-padding-left: 1rem;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.index-page .game-slider::-webkit-scrollbar {
  display: none;
}

.index-page .game-card {
  flex: 0 0 90px;
  background: linear-gradient(145deg, #ffffff, #f0f0f0);
  border-radius: 16px;
  box-shadow: 0 6px 16px rgba(0,0,0,0.1);
  padding: 0.5rem;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  transition: transform 0.1s ease;
  border: 1px solid rgba(0,0,0,0.05);
  backdrop-filter: blur(4px);
}

 

.index-page .game-card .thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  object-fit: cover;
  box-shadow: inset 0 0 0 1px #eee;
}

.index-page .game-card button {
  width: 100%;
  padding: 0.3rem 0.2rem;
  border: none;
  border-radius: 8px;
  font-size: 0.65rem;
  font-family: 'Pretendard Variable', sans-serif;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 600;
  letter-spacing: -0.2px;
  position: relative;
  background-clip: padding-box;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1), inset 0 -2px 0 rgba(0,0,0,0.15);
}

.index-page .game-card .start-btn {
  background: linear-gradient(145deg, #ff5f6d, #ffc371);
  color: #fff;
  text-shadow: 0 1px 1px rgba(0,0,0,0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(2px);
}

.index-page .game-card .start-btn:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #c0392b;
}

.index-page .game-card .rank-btn {
  background: linear-gradient(145deg, #e0c3fc, #8ec5fc);
  color: #3b0a84;
  text-shadow: 0 1px 1px rgba(255,255,255,0.6);
  border: 1px solid rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(2px);
}

.index-page .game-card .rank-btn:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #e197b4;
}

.index-page .game-card .start-btn:active,
.index-page .game-card .rank-btn:active {
  transform: scale(0.97);
}

footer {
  background: #eee;
  padding: 1.5rem 1rem;
  font-size: 0.75rem;
  color: #555;
  text-align: center;
}

footer a {
  color: #555;
  text-decoration: underline;
  margin: 0 0.5rem;
}

/* 공통 순위 테이블 
#rank-table,
#my-school-table,
#school-table {
  width: 100%;
  max-width: 420px;
  margin: 20px auto;
  border-collapse: collapse;
  font-size: 1.05rem;
  background-color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  border-radius: 8px;
  overflow: hidden;
}

#rank-table th,
#my-school-table th,
#school-table th {
  background-color: #f0f4ff;
  padding: 12px;
  color: #333;
  font-weight: bold;
}

#rank-table td,
#my-school-table td,
#school-table td {
  padding: 12px;
  border-bottom: 1px solid #eee;
}

#rank-table tr:last-child td,
#my-school-table tr:last-child td,
#school-table tr:last-child td {
  border-bottom: none;
}

#my-school-name {
  font-size: 1.1rem;
  color: #666;
  display: block;
  margin-top: 4px;
}

.my-row {
  background-color: #fff6c6 !important;
  font-weight: bold;
}*/
/* 공통 순위 테이블 - index 스타일 통일 */
#rank-table,
#my-school-table,
#school-table {
  width: 100%;
  max-width: 420px;
  margin: 0 auto 1.5rem;
  border-collapse: collapse;
  font-size: 1rem;
  background-color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  border-radius: 8px;
  overflow: hidden;
}

#rank-table th,
#my-school-table th,
#school-table th {
  background-color: #f0f4ff;
  padding: 12px;
  color: #333;
  font-weight: bold;
}

#rank-table td,
#my-school-table td,
#school-table td {
  padding: 12px;
  border-bottom: 1px solid #eee;
  text-align: center;
}

#rank-table tr:last-child td,
#my-school-table tr:last-child td,
#school-table tr:last-child td {
  border-bottom: none;
}

#my-school-name {
  font-size: 1.1rem;
  color: #666;
  display: block;
  margin-top: 4px;
}

.my-row {
  background-color: #fff6c6 !important;
  font-weight: bold;
}
/* 게임별 공통 셀 */
.cell {
  aspect-ratio: 1 / 1;
  background: #ffffff;
  border: 2px solid #4e77ff;
  border-radius: 8px;
  font-size: 1.4rem;
  width: 60px;
  height: 60px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hidden {
  background: #ddd;
  color: transparent;
}

.correct {
  background: #4e77ff;
  color: white;
}

.wrong {
  background: #ff4e4e;
  color: white;
}
/* 기억력 게임 */
.board {
  display: grid;
  gap: 4px;
  max-width: 280px;
  margin: 20px auto;
  justify-content: center;
  grid-template-columns: repeat(5, 1fr);
}

/* 숫자 순서 게임 */
.number-board {
  display: grid;
  gap: 4px;
  max-width: 280px;
  margin: 20px auto;
  justify-content: center;
  grid-template-columns: repeat(5, 1fr);
}

.number-board .cell {
  width: 50px;
  height: 50px;
  font-size: 1.1rem;
  border-radius: 6px;
}

/* 짝 맞추기 */
.match-board {
  display: grid;
  grid-template-columns: repeat(4, 60px);
  gap: 4px;
  justify-content: center;
  margin: 20px auto;
}

.match-board .cell {
  width: 60px;
  height: 60px;
  font-size: 2rem;
  border-radius: 10px;
  background-color: #fff;
  transition: transform 0.2s ease;
}

/* 폭탄 피하기 */
.bomb-board {
  display: grid;
  justify-content: center;
  gap: 3px;
  max-width: 340px;
  margin: 20px auto;
}

.bomb-board .cell {
  font-size: 1.2rem;
}

.bomb-board .bomb {
  background-color: #e60000 !important;
  color: #fff !important;
}

/* 정확히 멈추기 */
.stop-container {
  margin-top: 40px;
}

.bar-zone {
  position: relative;
  width: 80vw; /* 혹은 px 고정값 */
  max-width: 500px;
  height: 40px;
  background-color: #eee;
  margin: 0 auto 20px;
  border-radius: 20px;
  overflow: hidden;
}

.target-zone {
  position: absolute;
  left: 45%;
  width: 10%;
  height: 100%;
  background-color: rgba(255, 0, 0, 0.2);
  border: 2px dashed red;
  box-sizing: border-box;
}

.moving-bar {
  position: absolute;
  top: 0;
  width: 30px; /* ⬅ 더 얇게 */
  height: 100%;
  background-color: #4e77ff;
  transition: none;
  transform: translateX(-50%); /* 💥 핵심: 중심 기준으로 이동 */
}

.stop-round-btn {
  background-color: #ff4e4e;
  color: white;
  border: none;
  border-radius: 50%;
  width: 120px;
  height: 120px;
  font-size: 1.6rem;
  font-weight: bold;
  cursor: pointer;
  margin: 20px auto;
  display: block;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s ease, background-color 0.3s;
}

.stop-round-btn:hover {
  background-color: #ff3333;
  transform: scale(1.05);
}

.stop-round-btn:active {
  background-color: #cc0000;
  transform: scale(0.95);
}

/* 무한의 계단 */
.stairs-area {
  position: relative;
  height: 400px;
  background: linear-gradient(to top, #f0f8ff, #dbe9ff);
  border: 2px solid #4e77ff;
  border-radius: 12px;
  margin: 20px auto;
  max-width: 360px;
  overflow: hidden;
}

#character {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  font-size: 2.5rem;
  transition: margin 0.2s ease;
}

.btn-row {
  display: flex;
  justify-content: space-around;
  margin-top: 20px;
  padding: 0 20px;
}

.control-btn {
  flex: 1;
  margin: 0 8px;
  padding: 16px;
  font-size: 1.3rem;
  background-color: #4e77ff;
  color: white;
  border: none;
  border-radius: 30px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.stair-block {
  position: absolute;
  width: 40px;
  height: 10px;
  background-color: #4e77ff;
  border-radius: 5px;
  transition: bottom 0.2s ease;
}

.stair-block.left {
  transform: translateX(-100%);
}

.stair-block.right {
  transform: translateX(0%);
}
/*가위바위보*/
.rps-game-area { margin: 30px auto; background: #fff; padding: 20px; border-radius: 15px; width: 90%; max-width: 400px; box-shadow: 0 4px 8px rgba(0,0,0,0.1); text-align: center; }

.rps-image-box { height: 100px; margin: 10px 0; font-size: 80px; }

.rps-score { font-size: 18px; margin-top: 10px; }

#rps-stopBtn { background-color: #2196f3; color: white; padding: 10px 20px; font-size: 16px; border: none; border-radius: 10px; cursor: pointer; margin-top: 10px; }



/* 폭죽 애니메이션 */
.firework {
  position: fixed;
  width: 6px;
  height: 6px;
  background: #fff;
  border-radius: 50%;
  animation: explode 700ms ease-out forwards;
  pointer-events: none;
  z-index: 9999;
}

@keyframes explode {
  0% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(4) translate(0, -50px);
  }
}

#click-btn {
  background-color: #ff4e4e;
  color: #fff;
  font-size: 2rem;
  padding: 2rem;
  border: none;
  border-radius: 50px;
  margin-top: 20px;
  width: 90%;
  max-width: 460px;
  transition: transform 0.1s ease;
}

#click-btn:active {
  transform: scale(0.95);
}
/*커스텀 알럿*/
.custom-alert {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background: rgba(0,0,0,0.5);
  display: flex !important;
  justify-content: center;
  align-items: center;
  z-index: 99999 !important;
}

.custom-alert-inner {
  background: white;
  padding: 1.5rem;
  border-radius: 12px;
  width: 90%;
  max-width: 300px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.custom-alert .message {
  font-size: 1rem;
  margin-bottom: 1rem;
}

.custom-alert .close-btn {
  background: #4e77ff;
  color: white;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

.custom-alert.success .custom-alert-inner { background: #e6f9ec; }
.custom-alert.error .custom-alert-inner { background: #ffeaea; }
.custom-alert.info .custom-alert-inner { background: #f4f4f4; }



/* 로그인 페이지 전용 스타일 */
body.login-page {
  background: linear-gradient(to bottom, #fff9f9, #dbeeff);
  font-family: 'Gowun Dodum', sans-serif;
  min-height: 100vh;
}

.login-main {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2rem 1rem;
}

.login-box {
  background: white;
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  width: 100%;
  max-width: 400px;
}

.login-box h1 {
  text-align: center;
  font-size: 1.8rem;
  margin-bottom: 20px;
  font-family: 'Gowun Dodum', sans-serif;
}

.login-box .input-group {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  align-items: center; /* 버튼 수직 가운데 정렬 */
}

.login-box input[type="text"],
.login-box input[type="hidden"] {
  flex: 1;
  min-width: 0; /* 길이 줄어들 때 글자 자르지 않도록 */
  padding: 10px;
}

.login-box button {
  padding: 10px 16px;
  background: #4e77ff;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  font-family: inherit;
  flex-shrink: 0;       /* 버튼이 줄어들지 않게 */
  white-space: nowrap;  /* 버튼 줄바꿈 방지 */
}

.login-box button:hover {
  background: #3759d8;
}

#kakao-login,
#kakao-join {
  width: 100%;
  background: #FEE500;
  color: #3C1E1E;
  margin-top: 20px;
}

.login-box .status {
  margin-top: 10px;
  font-size: 0.9rem;
  color: #333;
  text-align: center;
}

/* 학교 검색 팝업 */
#school-popup {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 1000;
  overflow-y: auto;
  padding: 1rem;
}

#school-popup .popup-inner {
  background: white;
  padding: 1rem;
  border-radius: 10px;
  max-width: 360px;
  margin: 100px auto;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  max-height: 80vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

#school-popup h3 {
  margin-bottom: 10px;
  text-align: center;
}

#school-list {
  list-style: none;
  padding: 0;
  margin: 0;
  overflow-y: auto;
  max-height: 50vh;
}

#school-list button {
  color: #222;
  background: #f9f9f9;
  display: block;
  width: 100%;
  padding: 8px;
  text-align: left;
  border: 1px solid #ddd;
  border-radius: 6px;
  margin-bottom: 6px;
  font-size: 1rem;
  font-weight: 500;
  font-family: inherit;
}

#school-list button:hover {
  background: #d0e3ff;
}

#school-popup.show {
  display: flex;
  justify-content: center;
  align-items: center;
}

.guide {
  background: #fff5cc;
  border: 1px solid #ffcc00;
  border-radius: 10px;
  padding: 15px;
  margin: 10px 0;
  font-size: 16px;
  text-align: center;
}

    
  #loading { 
    z-index: 999; /* 로딩 오버레이보다 낮게 */ 
  }
.loading-screen {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  background: linear-gradient(135deg, #ffebf0, #d0f0ff);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  flex-direction: column;
  transition: opacity 0.5s ease;
  font-family: 'Pretendard', sans-serif;
}

.loading-inner {
  text-align: center;
}

.loading-mascot {
  width: 120px;
  margin-bottom: 20px;
  animation: bounce 1.2s infinite;
}

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

.loading-text {
  font-size: 20px;
  font-weight: bold;
  color: #444;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2px;
}

.dot {
  animation: blink 1.2s infinite;
  font-weight: normal;
  color: #888;
}

.dot:nth-child(2) { animation-delay: 0.2s; }
.dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes blink {
  0%, 80%, 100% { opacity: 0.2; }
  40% { opacity: 1; }
}
    .loading-bar {
  width: 60%;
  height: 12px;
  background: #eee;
  border-radius: 6px;
  overflow: hidden;
  margin-top: 16px;
}

.loading-progress {
  height: 100%;
  width: 0%;
  background: linear-gradient(to right, #ff8aa7, #ff6493);
  transition: width 0.3s ease;
}

.loading-percent {
  margin-top: 8px;
  font-size: 16px;
  font-weight: 500;
  color: #666;
}