/* 메모리 게임 스타일 - React 버전과 일치하도록 포팅 */

body {
  margin: 0;
  background: #000;
  /* 더블탭 줌과 핀치 줌만 방지, 세로 스크롤만 허용 */
  touch-action: pan-y;
  /* 사용자 선택 방지 */
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  box-sizing: border-box;
}

/* 숨김 요소 */
.a11y {
  position: absolute;
  left: -9999px;
  opacity: 0;
  overflow: hidden;
}

/* 게임 컨테이너 */
.memory-game-container {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  padding: 40px 0 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-image: url('./img/pattbg.jpg');
  background-size: cover;
  background-position: 50%;
  position: relative;
  /* 더블탭 줌과 핀치 줌만 방지, 세로 스크롤만 허용 */
  touch-action: pan-y;
  /* 사용자 선택 방지 */
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  box-sizing: border-box;
}

@media (max-width: 960px) {
  .memory-game-container {
    padding: 0 6px;
  }
}

/* 오버레이 */
.memory-game-container .overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 5;
  opacity: 0;
  visibility: hidden;
  transition: all 0.5s;
}

.memory-game-container .overlay.active {
  opacity: 1;
  visibility: visible;
}

.memory-game-container .overlay .overlay-content {
  background-color: rgba(0, 0, 0, 0.8);
  border-radius: 10px;
  padding: 30px;
  text-align: center;
  max-width: 400px;
  min-width: 300px;
}

.memory-game-container .overlay .overlay-content h2 {
  color: #fff;
  font-size: 28px;
  margin-bottom: 20px;
}

.memory-game-container .overlay .overlay-content h2.stage-title {
  color: #ffbb44;
}

.memory-game-container .overlay .overlay-content .stage-guide-image {
  display: block;
  width: 80%;
  margin: 10px auto 20px;
}

.memory-game-container .overlay .overlay-content p {
  color: #fff;
  font-size: 18px;
  margin-bottom: 15px;
}

.memory-game-container .overlay .overlay-content .score-animation {
  display: flex;
  justify-content: space-around;
  margin: 20px 0;
}

.memory-game-container .overlay .overlay-content .score-animation .score-item {
  display: flex;
  flex-direction: column;
}

.memory-game-container .overlay .overlay-content .score-animation .score-item .label {
  color: #fff;
  font-size: 14px;
  opacity: 0.8;
}

.memory-game-container .overlay .overlay-content .score-animation .score-item .value {
  color: #fff;
  font-size: 24px;
  font-weight: 700;
  transition: color 0.3s;
}

.memory-game-container .overlay .overlay-content .score-animation .score-item .value.number-changing {
  color: #fb4;
}

.memory-game-container .overlay .overlay-content button {
  padding: 10px 20px;
  background-color: #164d74;
  color: #fff;
  border: none;
  border-radius: 5px;
  font-size: 16px;
  cursor: pointer;
  margin-top: 20px;
  transition: all 0.3s;
}

.memory-game-container .overlay .overlay-content button:hover {
  background-color: #1e699f;
}

/* 640px 이하에서 오버레이 콘텐츠 최대 너비 조정 */
@media (max-width: 640px) {
  .memory-game-container .overlay .overlay-content {
    max-width: 70%;
  }
}

/* 스플래시 화면 */
.splash-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  cursor: pointer;
  animation: fadeIn 0.5s ease-out;
}

/* 스플래시 화면이 활성화되어 있을 때 다른 모든 요소 숨기기 */
.splash-screen ~ * {
  display: none !important;
}

.splash-screen .splash-content {
  text-align: center;
  animation: slideInUp 0.8s ease-out;
}

.splash-screen .splash-content .splash-logo {
  max-width: 600px;
  width: 80%;
  height: auto;
  margin-bottom: 30px;
  filter: drop-shadow(0 0 60px rgb(0, 0, 0));
  transition: all 0.3s ease;
}

@media (max-width: 960px) {
  .splash-screen .splash-content .splash-logo {
    max-width: 300px;
    margin-bottom: 20px;
  }
}

.splash-screen .splash-content .splash-text {
  color: #fff;
  font-size: 24px;
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
  margin: 0;
  animation: pulse 2s ease-in-out infinite;
}

@media (max-width: 960px) {
  .splash-screen .splash-content .splash-text {
    font-size: 18px;
  }
}

/* 카드 타입별 뒷면 */
.type-1 .card-back {
  background-image: url('./img/card_1.png');
  outline: 1px solid #f90005;
}

.type-2 .card-back {
  background-image: url('./img/card_2.png');
  outline: 1px solid #4569b3;
}

.type-3 .card-back {
  background-image: url('./img/card_3.png');
  outline: 1px solid #2b938b;
}

/* 게임 영역 */
.game-area {
  width: 100%;
  max-width: 620px;
  min-height: 320px;
  background: linear-gradient(180deg, rgba(77, 77, 77, 0.7), rgba(44, 44, 44, 0.5));
  border-radius: 10px;
  padding: 20px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
}

@media (max-width: 960px) {
  .game-area {
    width: 94%;
    border-radius: 5px;
    padding: 8px 6px;
  }
}

/* 타이머 프로그레스 컨테이너 */
.timer-progress-container {
  width: 100%;
  max-width: 680px;
  height: 60px;
  margin: 0 auto 15px;
  position: relative;
}

.timer-progress-container .bomb-container {
  display: flex;
  align-items: center;
  width: calc(100% - 100px);
  height: 100%;
  position: relative;
}

@media (max-width: 639px) {
  .timer-progress-container .bomb-container {
    width: calc(100% - 70px);
  }
}

.timer-progress-container .bomb-container .bomb {
  position: absolute;
  left: 10px;
  width: 80px;
  height: 80px;
  margin-top: -30px;
  z-index: 2;
}

.timer-progress-container .bomb-container .bomb .bomb-body {
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 30% 30%, #3a3a3a, #1a1a1a);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.5), inset -5px -5px 10px rgba(0, 0, 0, 0.3);
  position: relative;
  animation: bombPulse 2s ease-in-out infinite;
}

.timer-progress-container .bomb-container .bomb .bomb-body .timer-text {
  color: #fff;
  font-size: 24px;
  font-weight: 700;
  text-shadow: 0 0 10px rgba(255, 100, 0, 0.5);
  z-index: 1;
}

.timer-progress-container .bomb-container .bomb .bomb-highlight {
  position: absolute;
  top: 15%;
  left: 25%;
  width: 30%;
  height: 30%;
  background: radial-gradient(ellipse, rgba(255, 255, 255, 0.3), transparent);
  border-radius: 50%;
  transform: rotate(-45deg);
}

.timer-progress-container .bomb-container .bomb .explosion {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100px;
  height: 100px;
}

.timer-progress-container .bomb-container .bomb .explosion .explosion-particle {
  position: absolute;
  width: 20px;
  height: 20px;
  background: radial-gradient(circle, #ff6b35, red);
  border-radius: 50%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: explode 0.8s ease-out forwards;
}

.timer-progress-container .bomb-container .bomb .explosion .explosion-particle:first-child {
  --ex: -50px;
  --ey: -50px;
  animation-delay: 0s;
}

.timer-progress-container .bomb-container .bomb .explosion .explosion-particle:nth-child(2) {
  --ex: 50px;
  --ey: -50px;
  animation-delay: 0.05s;
}

.timer-progress-container .bomb-container .bomb .explosion .explosion-particle:nth-child(3) {
  --ex: -50px;
  --ey: 50px;
  animation-delay: 0.1s;
}

.timer-progress-container .bomb-container .bomb .explosion .explosion-particle:nth-child(4) {
  --ex: 50px;
  --ey: 50px;
  animation-delay: 0.15s;
}

.timer-progress-container .bomb-container .bomb .explosion .explosion-particle:nth-child(5) {
  --ex: 0px;
  --ey: -70px;
  animation-delay: 0.2s;
  background: radial-gradient(circle, #ffe66d, #ff9558);
}

.timer-progress-container .bomb-container .bomb .explosion .explosion-particle:nth-child(6) {
  --ex: -70px;
  --ey: 0px;
  animation-delay: 0.25s;
  background: radial-gradient(circle, #ffaa00, #ff6b35);
}

.timer-progress-container .bomb-container .bomb .explosion .explosion-particle:nth-child(7) {
  --ex: 70px;
  --ey: 0px;
  animation-delay: 0.3s;
  background: radial-gradient(circle, #ff9558, #ff4444);
}

.timer-progress-container .bomb-container .bomb .explosion .explosion-particle:nth-child(8) {
  --ex: 0px;
  --ey: 70px;
  animation-delay: 0.35s;
  background: radial-gradient(circle, #ff6b35, red);
}

.timer-progress-container .bomb-container.loading .bomb-body {
  background: radial-gradient(circle at 30% 30%, #2a2a2a, #1a1a1a);
  animation: loadingPulse 1.5s ease-in-out infinite;
}

.timer-progress-container .bomb-container.loading .bomb-body .timer-text {
  opacity: 0;
}

.timer-progress-container .bomb-container.loading .bomb-highlight,
.timer-progress-container .bomb-container.loading .fuse-container {
  opacity: 0.3;
}

.timer-progress-container .bomb-container.exploded .bomb-body {
  animation: none;
  background: radial-gradient(circle at 30% 30%, #8a3a3a, #4a1a1a);
  transform: scale(0.9);
  opacity: 0.7;
}

.timer-progress-container .bomb-container.exploded .bomb-body .timer-text {
  opacity: 0.3;
}

.timer-progress-container .bomb-container.exploded .bomb-highlight {
  opacity: 0;
}

.timer-progress-container .bomb-container .fuse-container {
  position: relative;
  flex: 1 1;
  height: 8px;
  margin-left: 40px;
}

.timer-progress-container .bomb-container .fuse-container .fuse-image-container {
  position: absolute;
  width: calc(100% - 40px);
  height: 100%;
  top: -8px;
  left: 40px;
}

.timer-progress-container .bomb-container .fuse-container .fuse-image-container .fuse-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: clip-path 0.5s linear;
}

.timer-progress-container .bomb-container .fuse-container .spark {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 30px;
  height: 30px;
  transition: left 0.5s linear;
  z-index: 3;
}

.timer-progress-container .bomb-container .fuse-container .spark .spark-particle {
  position: absolute;
  width: 6px;
  height: 6px;
  background: #ff6b35;
  border-radius: 50%;
  animation: sparkle 0.7s linear infinite;
  box-shadow: 0 0 8px rgba(255, 107, 53, 0.9);
  top: 50%;
  left: 50%;
  transform-origin: center;
}

.timer-progress-container .bomb-container .fuse-container .spark .spark-particle:first-child {
  --tx: -13.5px;
  --ty: -16.5px;
  animation-delay: 0s;
  background: #ffe66d;
  box-shadow: 0 0 8px rgba(255, 230, 109, 0.9);
}

.timer-progress-container .bomb-container .fuse-container .spark .spark-particle:nth-child(2) {
  --tx: 15px;
  --ty: -10.5px;
  animation-delay: 0.07s;
  background: #ff9558;
  box-shadow: 0 0 8px rgba(255, 149, 88, 0.9);
}

.timer-progress-container .bomb-container .fuse-container .spark .spark-particle:nth-child(3) {
  --tx: -10.5px;
  --ty: 13.5px;
  animation-delay: 0.14s;
  background: #ff6b35;
  box-shadow: 0 0 8px rgba(255, 107, 53, 0.9);
}

.timer-progress-container .bomb-container .fuse-container .spark .spark-particle:nth-child(4) {
  --tx: 18px;
  --ty: 6px;
  animation-delay: 0.21s;
  background: #ffaa00;
  box-shadow: 0 0 8px rgba(255, 170, 0, 0.9);
}

.timer-progress-container .bomb-container .fuse-container .spark .spark-particle:nth-child(5) {
  --tx: -6px;
  --ty: -15px;
  animation-delay: 0.28s;
  background: #ff4444;
  box-shadow: 0 0 8px rgba(255, 68, 68, 0.9);
}

.timer-progress-container .bomb-container .fuse-container .spark .spark-particle:nth-child(6) {
  --tx: 9px;
  --ty: -18px;
  animation-delay: 0.35s;
  background: #ff8844;
  box-shadow: 0 0 8px rgba(255, 136, 68, 0.9);
}

.timer-progress-container .bomb-container .fuse-container .spark .spark-particle:nth-child(7) {
  --tx: -16.5px;
  --ty: 3px;
  animation-delay: 0.42s;
  background: #ffcc33;
  box-shadow: 0 0 8px rgba(255, 204, 51, 0.9);
}

.timer-progress-container .bomb-container .fuse-container .spark .spark-particle:nth-child(8) {
  --tx: 6px;
  --ty: 15px;
  animation-delay: 0.49s;
  background: #ff5533;
  box-shadow: 0 0 8px rgba(255, 85, 51, 0.9);
}

.timer-progress-container .bomb-container .fuse-container .spark .spark-particle:nth-child(9) {
  --tx: -9px;
  --ty: -6px;
  animation-delay: 0.56s;
  background: #ff7722;
  box-shadow: 0 0 8px rgba(255, 119, 34, 0.9);
}

.timer-progress-container .bomb-container .fuse-container .spark .spark-particle:nth-child(10) {
  --tx: 13.5px;
  --ty: 10.5px;
  animation-delay: 0.63s;
  background: #ffbb44;
  box-shadow: 0 0 8px rgba(255, 187, 68, 0.9);
}

.timer-progress-container .bomb-container .fuse-container .fuse-end-flame {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  transition: left 0.5s linear;
  z-index: 2;
}

.timer-progress-container .bomb-container .fuse-container .fuse-end-flame .flame-core {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 12px;
  height: 12px;
  background: radial-gradient(circle, #ffe66d 0%, #ff9558 50%, #ff6b35 100%);
  border-radius: 50%;
  animation: flameFlicker 0.3s ease-in-out infinite alternate;
  box-shadow: 0 0 10px rgba(255, 230, 109, 0.8);
}

.timer-progress-container .bomb-container .fuse-container .fuse-end-flame .flame-outer {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 16px;
  height: 16px;
  background: radial-gradient(circle, rgba(255, 107, 53, 0.6) 0%, rgba(255, 149, 88, 0.3) 70%, transparent 100%);
  border-radius: 50%;
  animation: flameFlicker 0.4s ease-in-out infinite alternate-reverse;
}

.timer-progress-container .bomb-container .flip-counter {
  position: absolute;
  right: -80px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.timer-progress-container .bomb-container .flip-counter .label {
  font-size: 12px;
  opacity: 0.8;
  color: #fff;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.timer-progress-container .bomb-container .flip-counter .value {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.timer-progress-container .bomb-container .flip-counter.warning .value {
  color: #ffbb44;
}

.timer-progress-container .bomb-container .flip-counter.danger .value {
  color: red;
  animation: textFlash 0.5s ease-in-out infinite;
}

.timer-progress-container .bomb-container .flip-counter.loading .label {
  opacity: 0.4;
}

@media (max-width: 960px) {
  .timer-progress-container {
    height: 50px;
    margin-bottom: 10px;
  }

.timer-progress-container .bomb-container .fuse-container .fuse-image-container {
  width: calc(100% - 20px);
  left: 30px;
}

  .timer-progress-container .bomb-container .bomb {
    width: 60px;
    height: 60px;
    left: 5px;
  }

  .timer-progress-container .bomb-container .bomb .bomb-body .timer-text {
    font-size: 18px;
  }

  .timer-progress-container .bomb-container .fuse-container {
    margin-left: 30px;
  }

  .timer-progress-container .bomb-container .flip-counter {
    right: -60px;
  }

  .timer-progress-container .bomb-container .flip-counter .label {
    font-size: 10px;
  }

  .timer-progress-container .bomb-container .flip-counter .value {
    font-size: 16px;
  }
}

/* 위험 상태 폭탄 */
.timer-progress-container .bomb-container.danger .bomb-body {
  animation: bombPulseDanger 2s ease-in-out infinite;
  background: radial-gradient(circle at 30% 30%, #5a2a2a, #2a1a1a);
}

.timer-progress-container .bomb-container.danger .bomb-body .timer-text {
  color: #ff4444;
  animation: textFlash 0.5s ease-in-out infinite;
}

.timer-progress-container .bomb-container.danger .spark-particle {
  animation: sparkleFast 0.4s linear infinite;
  width: 6px;
  height: 6px;
  box-shadow: 0 0 10px rgba(255, 0, 0, 0.9);
}

/* 점수판 */
.scoreboard {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #fff;
  font-size: 14px;
}

.scoreboard .current-score {
  font-weight: 700;
}

.scoreboard .best-score {
  display: flex;
  align-items: center;
}

/* 카드 보드 */
.card-board {
  display: grid;
  grid-gap: 14px;
  margin: 20px 0;
  justify-content: center;
  width: 100%;
  max-width: 100%;
  /* 더블탭 줌과 핀치 줌만 방지, 세로 스크롤만 허용 */
  touch-action: pan-y;
  /* 사용자 선택 방지 */
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

@media (max-width: 960px) {
  .card-board {
    width: 100%;
    max-width: 100%;
    grid-gap: 8px;
  }
}

.card-board.cards-8 {
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(2, 1fr);
}

.card-board.cards-12 {
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(3, 1fr);
}

.card-board.cards-16 {
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
}

.card-board.no-animation .card-back,
.card-board.no-animation .card-front,
.card-board.no-animation .card-inner {
  transition: none !important;
}

/* 카드 스타일 */
.card {
  width: 100%;
  height: 100%;
  aspect-ratio: 446/628;
  position: relative;
  cursor: pointer;
  box-sizing: border-box;
  font-size: 14px;
  border-radius: 10px;
  overflow: visible;
  perspective: 3500px;
  perspective-origin: 50%;
  animation: cardFadeIn 0.3s ease-out forwards;
  /* 더블탭 줌과 핀치 줌만 방지, 세로 스크롤만 허용 */
  touch-action: pan-y;
  /* 사용자 선택 방지 */
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

@media (max-width: 960px) {
  .card {
    perspective: 6000px;
    border-radius: 5px;
  }
}

.card.flipping {
  z-index: 1;
}

.card:not(.flip-to-front):not(.flip-to-back) .card-inner {
  transform: rotateY(0deg);
}

.card.dummy-card {
  pointer-events: none;
  opacity: 0.5;
  animation: none;
}

.card.dummy-card .card-inner {
  transform: rotateY(0deg);
  transition: none;
}

.card.dummy-card .card-back {
  background-color: rgba(80, 80, 80, 0.4);
  background-image: none;
  border: 1px dashed rgba(255, 255, 255, 0.3);
  filter: grayscale(100%) brightness(0.7);
}

.card.dummy-card .card-back::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  animation: shimmer 1.5s infinite;
}

.card-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.25s ease;
  animation-duration: 0.25s;
  animation-fill-mode: both;
  animation-timing-function: linear;
}

.card-inner.flipped {
  transform: rotateY(-180deg);
}

.card:not(.flip-to-front):not(.flip-to-back) .card-inner {
  animation: none !important;
}

.flip-to-front .card-inner {
  animation-name: flip-to-front;
  transition: none;
}

.flip-to-back .card-inner {
  animation-name: flip-to-back;
  transition: none;
}

.card-inner.matched {
  pointer-events: none;
}

.card-inner.matched .card-back,
.card-inner.matched .card-front {
  filter: drop-shadow(0 0 10px rgba(255, 255, 80, 0.4));
}

.card-inner.disabled {
  pointer-events: none;
}

.card-inner .card-back,
.card-inner .card-front {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  backface-visibility: hidden;
  overflow: hidden;
  transition: all 0.3s;
  border-radius: 10px;
  filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.4));
  transform-style: preserve-3d;
}

@media (max-width: 960px) {
  .card-inner .card-back,
  .card-inner .card-front {
    border-radius: 5px;
  }
}

.card-inner .card-front {
  transform: rotateY(180deg);
  background-color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 50px;
  position: relative;
  overflow: hidden;
  z-index: 2;
}

.card-inner .card-front img {
  width: 104%;
  height: 104%;
  object-fit: cover;
  object-position: top;
}

.card-inner .card-front::before {
  content: "";
}

.card-inner .card-front .card-info {
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 100%;
  padding: 20px 8px 5px;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.8));
  color: #fff;
  text-align: left;
  display: flex;
  flex-direction: column;
  letter-spacing: -0.015em;
  align-items: left;
  justify-content: flex-end;
  z-index: 3;
}

@media (max-width: 960px) {
  .card-inner .card-front .card-info {
    letter-spacing: -0.025em;
    padding: 14px 4px 3px;
  }
}

.card-inner .card-front .card-info .card-title {
  font-size: 14px;
  line-height: 1.2;
  text-shadow: 0 1px 3px #000;
  white-space: nowrap;
}

.card-inner .card-front .card-info .card-character {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
  text-shadow: 0 1px 3px #000;
}

@media (max-width: 960px) {
  .card-inner .card-front .card-info .card-character {
    font-size: 14px;
  }
}

.card-inner .card-front .work-image {
  width: 104%;
  height: 104%;
  object-fit: cover;
}

.card-inner .card-front .title-card {
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at center, rgba(10, 10, 10, 0.9) 60%, rgba(44, 44, 44, 0.7) 120%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  box-sizing: border-box;
  overflow: hidden;
}

.card-inner .card-front .title-card .item-name {
  color: #FFF;
  font-size: 0.5em;
  font-weight: 700;
  text-align: center;
  line-height: 1.3;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
  word-break: break-all;
  overflow-wrap: break-word;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

@media (max-width: 960px) {
  .card-inner .card-front .title-card .item-name {
    font-size: 0.33em;
    line-height: 1.2;
    -webkit-line-clamp: 3;
  }
}

.card-inner .card-back {
  background-size: contain;
  background-position: 50%;
  transform: rotateY(0deg);
  z-index: 1;
}

/* 카드 제목 스타일 */
.card-title span {
  line-height: 1.2;
}

.card-title span[class*="couple"] {
  padding: 0 3px;
}

@media (max-width: 960px) {
  .card-title span[class*="couple"] {
    padding: 0 1px;
  }
}

.card-title span.same-image-title {
  background: rgba(0, 0, 0, 0.2);
  padding: 2px 6px;
  margin-bottom: 2px;
  margin-left: -6px;
  border-radius: 4px;
  display: inline-block;
  font-size: 1.1em;
  box-sizing: border-box;
}

@media (max-width: 960px) {
  .card-title span.same-image-title {
    padding: 1px 4px;
    border-radius: 3px;
    margin-left: -3px;
    margin-bottom: 1px;
  }
}

/* 커플 색상 */
.couple {
  opacity: 1;
}

.couple1 { background: rgba(255, 30, 30, 0.5); }
.couple2 { background: rgba(30, 255, 50, 0.5); }
.couple3 { background: rgba(30, 65, 255, 0.5); }
.couple4 { background: rgba(255, 225, 30, 0.5); }
.couple5 { background: rgba(255, 30, 255, 0.5); }
.couple6 { background: rgba(30, 230, 255, 0.5); }
.couple7 { background: rgba(255, 120, 30, 0.5); }
.couple8 { background: rgba(150, 30, 255, 0.5); }
.couple9 { background: rgba(30, 175, 255, 0.5); }
.couple10 { background: rgba(44, 44, 44, 0.5); }
.couple11 { background: rgba(180, 255, 30, 0.5); }
.couple12 { background: rgba(30, 255, 180, 0.5); }
.couple13 { background: rgba(170, 130, 255, 0.5); }

/* 축하 화면 */
.celebration-overlay {
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.9), rgba(20, 20, 50, 0.95));
  backdrop-filter: blur(10px);
}

.celebration-overlay .celebration-content {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.celebration-overlay .celebration-main {
  text-align: center;
  z-index: 10;
  position: relative;
  animation: celebrationFadeIn 1s ease-out;
}

.celebration-overlay .celebration-title {
  font-size: 48px;
  color: #fff;
  margin-bottom: 20px;
  text-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
  animation: titleGlow 2s ease-in-out infinite alternate;
}

@media (max-width: 960px) {
  .celebration-overlay .celebration-title {
    font-size: 32px;
    margin-bottom: 15px;
  }
}

.celebration-overlay .celebration-subtitle {
  font-size: 24px;
  color: #fff;
  margin-bottom: 40px;
  opacity: 0.9;
  animation: subtitleSlide 1s ease-out 0.5s both;
}

@media (max-width: 960px) {
  .celebration-overlay .celebration-subtitle {
    font-size: 18px;
    margin-bottom: 30px;
  }
}

.celebration-overlay .celebration-trophy {
  position: relative;
  margin: 40px auto;
  width: 120px;
  height: 120px;
  animation: trophyBounce 2s ease-in-out infinite;
}

@media (max-width: 960px) {
  .celebration-overlay .celebration-trophy {
    width: 80px;
    height: 80px;
    margin: 30px auto;
  }
}

.celebration-overlay .celebration-trophy .trophy-icon {
  font-size: 120px;
  line-height: 1;
  filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.8));
}

@media (max-width: 960px) {
  .celebration-overlay .celebration-trophy .trophy-icon {
    font-size: 80px;
  }
}

.celebration-overlay .celebration-trophy .trophy-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 150px;
  height: 150px;
  background: radial-gradient(circle, rgba(255, 215, 0, 0.3), transparent);
  border-radius: 50%;
  animation: glowPulse 2s ease-in-out infinite;
}

@media (max-width: 960px) {
  .celebration-overlay .celebration-trophy .trophy-glow {
    width: 100px;
    height: 100px;
  }
}

.celebration-overlay .celebration-score {
  margin: 40px 0;
  animation: scoreReveal 1s ease-out 1s both;
}

.celebration-overlay .celebration-score .final-score-label {
  font-size: 18px;
  color: #fff;
  opacity: 0.8;
  margin-bottom: 10px;
}

@media (max-width: 960px) {
  .celebration-overlay .celebration-score .final-score-label {
    font-size: 16px;
  }
}

.celebration-overlay .celebration-score .final-score-value {
  font-size: 48px;
  font-weight: 700;
  color: gold;
  text-shadow: 0 0 15px rgba(255, 215, 0, 0.8);
  margin-bottom: 15px;
}

@media (max-width: 960px) {
  .celebration-overlay .celebration-score .final-score-value {
    font-size: 36px;
  }
}

.celebration-overlay .celebration-score .new-record {
  font-size: 20px;
  color: #ff6b35;
  animation: recordFlash 1s ease-in-out infinite;
}

@media (max-width: 960px) {
  .celebration-overlay .celebration-score .new-record {
    font-size: 16px;
  }
}

.celebration-overlay .celebration-button {
  background-color: #164d74;
  color: #fff;
  border: none;
  padding: 15px 30px;
  font-size: 18px;
  font-weight: 700;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.3s ease;
  animation: buttonAppear 1s ease-out 1.5s both;
}

@media (max-width: 960px) {
  .celebration-overlay .celebration-button {
    padding: 12px 24px;
    font-size: 16px;
  }
}

.celebration-overlay .celebration-button:hover {
  background-color: #1e699f;
}

.celebration-overlay .celebration-button:active {
  transform: translateY(1px);
}

.celebration-overlay .celebration-fireworks {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.celebration-overlay .celebration-fireworks .firework {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  animation: fireworkExplode 3s ease-out infinite;
}

.celebration-overlay .celebration-fireworks .firework.firework-1 {
  top: 20%;
  left: 15%;
  background: #ff6b35;
  animation-delay: 0s;
}

.celebration-overlay .celebration-fireworks .firework.firework-2 {
  top: 30%;
  right: 20%;
  background: gold;
  animation-delay: 0.5s;
}

.celebration-overlay .celebration-fireworks .firework.firework-3 {
  top: 15%;
  left: 70%;
  background: #ff9558;
  animation-delay: 1s;
}

.celebration-overlay .celebration-fireworks .firework.firework-4 {
  bottom: 25%;
  left: 25%;
  background: #51a6ec;
  animation-delay: 1.5s;
}

.celebration-overlay .celebration-fireworks .firework.firework-5 {
  bottom: 30%;
  right: 15%;
  background: #ff6b35;
  animation-delay: 2s;
}

.celebration-overlay .celebration-fireworks .firework.firework-6 {
  top: 40%;
  left: 50%;
  background: gold;
  animation-delay: 2.5s;
}

.celebration-overlay .celebration-confetti {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.celebration-overlay .celebration-confetti .confetti {
  position: absolute;
  font-size: 24px;
  animation: confettiFall 4s linear infinite;
}

@media (max-width: 960px) {
  .celebration-overlay .celebration-confetti .confetti {
    font-size: 18px;
  }
}

.celebration-overlay .celebration-confetti .confetti.confetti-1 {
  left: 10%;
  animation-delay: 0s;
}

.celebration-overlay .celebration-confetti .confetti.confetti-2 {
  left: 20%;
  animation-delay: 0.5s;
}

.celebration-overlay .celebration-confetti .confetti.confetti-3 {
  left: 30%;
  animation-delay: 1s;
}

.celebration-overlay .celebration-confetti .confetti.confetti-4 {
  left: 50%;
  animation-delay: 1.5s;
}

.celebration-overlay .celebration-confetti .confetti.confetti-5 {
  left: 60%;
  animation-delay: 2s;
}

.celebration-overlay .celebration-confetti .confetti.confetti-6 {
  left: 70%;
  animation-delay: 2.5s;
}

.celebration-overlay .celebration-confetti .confetti.confetti-7 {
  left: 80%;
  animation-delay: 3s;
}

.celebration-overlay .celebration-confetti .confetti.confetti-8 {
  left: 90%;
  animation-delay: 3.5s;
}

/* 펄스 애니메이션 */
.pulse {
  animation: pulse 1s infinite;
}

/* 숫자 변경 애니메이션 */
.number-changing {
  animation: numbersChange 0.2s ease-in-out;
  color: #ffbb44;
  font-weight: 700;
}

/* 키프레임 애니메이션들 */
@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

@keyframes fadeIn {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

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

@keyframes cardFadeIn {
  0% {
    opacity: 0;
    transform: scale(0.95);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes shimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

@keyframes flip-to-back {
  0% {
    transform: translateZ(-0.667em) rotateY(-180deg);
    z-index: 1;
  }
  50% {
    transform: translateZ(45em) rotateY(-270deg);
    z-index: 1;
  }
  100% {
    transform: translateZ(0) rotateY(-360deg);
    z-index: 1;
  }
}

@keyframes flip-to-front {
  0% {
    transform: translateZ(0) rotateY(0deg);
    z-index: 1;
  }
  50% {
    transform: translateZ(45em) rotateY(-90deg);
    z-index: 1;
  }
  100% {
    transform: translateZ(-0.667em) rotateY(-180deg);
    z-index: 1;
  }
}

@keyframes numbersChange {
  0% { transform: scale(1); }
  50% {
    transform: scale(1.1);
    color: #ffbb44;
  }
  100% { transform: scale(1); }
}

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

@keyframes loadingPulse {
  0%, 100% {
    transform: scale(1);
    opacity: 0.7;
  }
  50% {
    transform: scale(1.02);
    opacity: 0.9;
  }
}

@keyframes bombPulseDanger {
  0%, 22%, 100% {
    transform: scale(1);
    box-shadow: 0 0 30px rgba(255, 0, 0, 0.5), inset -5px -5px 10px rgba(0, 0, 0, 0.3);
  }
  11% {
    transform: scale(1.1);
    box-shadow: 0 0 40px rgba(255, 0, 0, 0.8), inset -5px -5px 10px rgba(0, 0, 0, 0.3);
  }
}

@keyframes textFlash {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes sparkle {
  0% {
    transform: scale(1.2) translate(0);
    opacity: 1;
  }
  10% {
    transform: scale(1) translate(calc(var(--tx) * 0.3), calc(var(--ty) * 0.3));
    opacity: 1;
  }
  30% {
    transform: scale(0.9) translate(calc(var(--tx) * 1.2), calc(var(--ty) * 1.2));
    opacity: 0.8;
  }
  60%, 100% {
    transform: scale(0.8) translate(calc(var(--tx) * 2.1), calc(var(--ty) * 2.1));
    opacity: 0;
  }
}

@keyframes sparkleFast {
  0% {
    transform: scale(1.5) translate(0);
    opacity: 1;
  }
  15% {
    transform: scale(1.2) translate(calc(var(--tx) * 0.3), calc(var(--ty) * 0.3));
    opacity: 1;
  }
  50% {
    transform: scale(0.8) translate(calc(var(--tx) * 2.5), calc(var(--ty) * 2.5));
    opacity: 0.9;
  }
  100% {
    transform: scale(0.1) translate(calc(var(--tx) * 5), calc(var(--ty) * 5));
    opacity: 0;
  }
}

@keyframes explode {
  0% {
    transform: translate(-50%, -50%) scale(0.5);
    opacity: 1;
  }
  50% {
    transform: translate(calc(-50% + var(--ex) * 0.5), calc(-50% + var(--ey) * 0.5)) scale(1.5);
    opacity: 1;
  }
  100% {
    transform: translate(calc(-50% + var(--ex)), calc(-50% + var(--ey))) scale(0.3);
    opacity: 0;
  }
}

@keyframes flameFlicker {
  0% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(1.1);
    opacity: 0.8;
  }
}

@keyframes celebrationFadeIn {
  0% {
    opacity: 0;
    transform: scale(0.8);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes titleGlow {
  0% {
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
  }
  100% {
    text-shadow: 0 0 30px gold, 0 0 40px rgba(255, 215, 0, 0.5);
  }
}

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

@keyframes trophyBounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-10px);
  }
  60% {
    transform: translateY(-5px);
  }
}

@keyframes glowPulse {
  0%, 100% {
    opacity: 0.3;
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    opacity: 0.6;
    transform: translate(-50%, -50%) scale(1.1);
  }
}

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

@keyframes recordFlash {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

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

@keyframes fireworkExplode {
  0% {
    opacity: 1;
    transform: scale(0);
  }
  15% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(3);
  }
}

@keyframes confettiFall {
  0% {
    opacity: 1;
    transform: translateY(-100vh) rotate(0deg);
  }
  100% {
    opacity: 0;
    transform: translateY(100vh) rotate(360deg);
  }
}