* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: radial-gradient(
    ellipse at 50% 40%,
    #203e69 0%,
    #101f3d 45%,
    #080f25 85%
  );
  color: #e9d8b4;
  font-family: Georgia, "Malgun Gothic", serif;
  text-align: center;
}

main {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.screen {
  width: min(100%, 480px);
  animation: appear .65s ease both;
}

[hidden] { display: none !important; }

.label {
  color: #c8a76b;
  font-size: 12px;
  letter-spacing: 3px;
}

h1 { font-size: clamp(25px, 6vw, 34px); }
h2 { font-size: clamp(23px, 5vw, 30px); }

.description {
  color: #a8bdc9;
  line-height: 1.8;
}

.chest {
  position: relative;

  width: min(100%, 340px);
  aspect-ratio: 4 / 3;
  height: auto;

  margin: 30px auto;

  /* STEP 6-3T: 고객 C 상자 얼음빛 그림자 */
  filter: drop-shadow(0 0 25px rgba(142, 210, 242, 0.4));

  animation: float 3s ease-in-out infinite;
}

.chest-image {
  position: absolute;
  width: 100%;
  height: 100%;
  object-fit: contain;
  top: 0;
  left: 0;
  z-index: 2;
}

button {
  padding: 14px 35px;
  color: #f1dbac;
  background: linear-gradient(#20506a, #103247);
  border: 1px solid #c9a56b;
  font: inherit;
  font-weight: bold;
  cursor: pointer;
  transition: filter .2s;
}

button:hover { filter: brightness(1.25); }

/* STEP 2-3F: Reward detail button */
#detail {
  position: relative;

  min-height: 52px;
  padding: 14px 36px;

  border: 1px solid #80bdd8;
  border-radius: 10px;

  background: linear-gradient(
    110deg,
    #204f73 0%,
    #183c60 55%,
    #102c4a 100%
  );

  color: #e8f5ff;
  font-size: 16px;
  font-weight: bold;
  letter-spacing: 1px;

  box-shadow:
    0 0 18px rgba(105, 192, 231, 0.16),
    0 0 22px rgba(142, 210, 242, 0.1);

  transition:
    filter 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.2s ease;
}

/* STEP 6-3V: 고객 C 자세히 보기 버튼 얼음빛 호버 효과 */
#detail:hover {
  filter: brightness(1.12);

  box-shadow:
    0 0 22px rgba(105, 192, 231, 0.28),
    0 0 28px rgba(169, 216, 233, 0.2);

  transform: translateY(-2px);
}

#detail:active {
  transform: translateY(0);
}

/* STEP 2-4D: Surprise restart button */
#restart {
  margin-top: 20px;
  min-height: 50px;
  padding: 13px 34px;

  border: 1px solid #80bdd8;
  border-radius: 10px;

  background: linear-gradient(
    110deg,
    #204f73 0%,
    #183c60 55%,
    #102c4a 100%
  );

  color: #e8f5ff;
  font-size: 15px;
  font-weight: bold;
  letter-spacing: 1px;

  box-shadow:
    0 0 16px rgba(105, 192, 231, 0.16),
    0 0 20px rgba(142, 210, 242, 0.1);

  transition:
    filter 0.2s ease,
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

/* STEP 6-3W: 고객 C 다시 보기 버튼 얼음빛 호버 효과 */
#restart:hover {
  filter: brightness(1.12);
  transform: translateY(-2px);

  box-shadow:
    0 0 20px rgba(105, 192, 231, 0.22),
    0 0 25px rgba(169, 216, 233, 0.16);
}

#restart:active {
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  #restart {
    transition: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  #detail {
    transition: none;
  }
}

button:disabled { cursor: wait; opacity: .7; }

/* STEP 4-3F: Ornni Studio 버튼 크기 통일 */
#open,
#detail,
#restart {
  box-sizing: border-box;
  min-height: 54px;
  border-radius: 12px;
  font-size: 14px;
}

/* STEP 6-3X: 고객 C 버튼 키보드 포커스 얼음 테마 */
#open:focus-visible,
#detail:focus-visible,
#restart:focus-visible {
  outline: 3px solid #a9d8e9;
  outline-offset: 4px;
}

/* STEP 4-3I: 터치 기기 버튼 호버 효과 보정 */
@media (hover: none) {
  #open:hover:not(:disabled),
  #detail:hover,
  #restart:hover {
    filter: none;
    transform: none;
  }
}

/* STEP 4-3I 보완: 모바일 터치 하이라이트 통일 */
#open,
#detail,
#restart {
  -webkit-tap-highlight-color: transparent;
}

/* STEP 6-6B: 얼음 균열 개봉 준비 - 상자 흔들림 제거 */
.opening .chest {
  animation: none;
}

/* STEP 6-3R: 고객 C 첫 화면 레이블 얼음 테마 */
#loot .label {
  color: #a9d8e9;
  font-size: 12px;
  font-weight: bold;
  letter-spacing: 3px;
  text-shadow: 0 0 14px rgba(105, 192, 231, 0.3);
}

/* STEP 6-3S: 고객 C 첫 화면 제목 얼음 테마 */
#loot h1 {
  color: #e8f5ff;
  font-size: clamp(20px, 5vw, 32px);
  line-height: 1.45;

  text-shadow:
    0 0 20px rgba(169, 216, 233, 0.25),
    0 0 30px rgba(105, 192, 231, 0.15);
}

/* 첫 화면 설명 */
#loot .description {
  color: #afc7d6;
  font-size: 14px;
  line-height: 1.8;
}

/* 상자 열기 버튼 */
#open {
  position: relative;
  min-height: 54px;
  max-width: 100%;
  padding: 15px 36px;

  border: 1px solid #80bdd8;
  border-radius: 12px;

  background: linear-gradient(
    110deg,
    #204f73 0%,
    #183c60 55%,
    #102c4a 100%
  );

  color: #e8f5ff;
  font-size: 16px;
  font-weight: bold;
  letter-spacing: 0.5px;

  box-shadow:
    0 0 20px rgba(105, 192, 231, 0.18),
    0 0 24px rgba(142, 210, 242, 0.14);

  transition:
    filter 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.2s ease;
}

/* STEP 6-3U: 고객 C 초대장 열기 버튼 얼음빛 호버 효과 */
#open:hover:not(:disabled) {
  filter: brightness(1.12);
  transform: translateY(-2px);

  box-shadow:
    0 0 24px rgba(105, 192, 231, 0.3),
    0 0 30px rgba(169, 216, 233, 0.22);
}

#open:active:not(:disabled) {
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  #open {
    transition: none;
  }
}

/* STEP 2-3A: Reward card base layout */
.reward-card {
  margin: 30px auto;
  padding: 25px;
  border-radius: 14px;

  border: 1px solid rgba(120, 187, 214, 0.65);

  background: linear-gradient(
    145deg,
    rgba(21, 46, 75, 0.92),
    rgba(11, 25, 48, 0.95)
  );

  box-shadow:
    0 0 22px rgba(105, 192, 231, 0.12),
    inset 0 0 18px rgba(142, 210, 242, 0.05);
}

/* STEP 6-3AA: 고객 C LEGENDARY 등급 강조 */
.reward-rarity {
  display: inline-block;
  margin: 4px auto 12px;
  padding: 7px 18px;

  border: 1px solid #d8b878;
  border-radius: 999px;

  background: rgba(76, 55, 37, 0.55);

  color: #f3d99e;
  font-size: 11px;
  font-weight: bold;
  letter-spacing: 2px;

  text-shadow: 0 0 10px rgba(243, 217, 158, 0.35);

  box-shadow:
    0 0 12px rgba(216, 184, 120, 0.18);
}

/* STEP 6-3AD: LEGENDARY 발광 애니메이션 시작 상태 개선 */
#reward .reward-rarity {
  animation: legendary-glow 2.8s ease-in-out 0.8s infinite backwards;
}

@keyframes legendary-glow {
  0%, 100% {
    box-shadow: 0 0 8px rgba(216, 184, 120, 0.12);
    text-shadow: 0 0 8px rgba(243, 217, 158, 0.25);
  }

  50% {
    box-shadow: 0 0 20px rgba(216, 184, 120, 0.4);
    text-shadow: 0 0 16px rgba(243, 217, 158, 0.6);
  }
}

/* 움직임 최소화 설정을 사용하는 경우 애니메이션 비활성화 */
@media (prefers-reduced-motion: reduce) {
  #reward .reward-rarity {
    animation: none;
  }
}

/* STEP 6-3Y: 고객 C 보상 카드 안내 문구 얼음 테마 */
.reward-card h2 {
  margin: 8px 0 12px;

  color: #e8f5ff;
  font-size: clamp(14px, 3.8vw, 23px);
  line-height: 1.5;
}

/* STEP 6-3Z: 고객 C 보상 설명 문구 얼음 테마 */
#reward-description {
  margin: 0 auto;
  max-width: 340px;

  color: #bdd9eb;
  font-size: 12px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

/* STEP 2-3D: Reward title styling */
#reward-name {
  position: relative;
  margin: 16px auto 22px;
  padding-bottom: 18px;

  color: #f2d8f3;
  font-size: clamp(28px, 7vw, 38px);
  font-weight: bold;
  letter-spacing: 2px;
  line-height: 1.4;

  text-shadow:
    0 0 12px rgba(243, 155, 218, 0.35),
    0 0 24px rgba(75, 231, 229, 0.18);
}

/* STEP 6-3M: 고객 C 보상 이름 얼음빛 구분선 */
#reward-name::after {
  content: "";
  position: absolute;

  bottom: 0;
  left: 50%;
  transform: translateX(-50%);

  width: 70%;
  max-width: 260px;
  height: 2px;

  background: linear-gradient(
    90deg,
    transparent,
    #a9d8e9 30%,
    #80bdd8 70%,
    transparent
  );
}

.reward-art {
  display: grid;
  place-items: center;
  height: 210px;
  margin-bottom: 20px;
  background: transparent;
  color: #e8c77d;
  font-size: 80px;
}

/* STEP 4-5C: 이미지 보상 표시 스타일 */
#reward-image {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 210px;
  object-fit: contain;
  object-position: center;
}

/* STEP 2-3B: Prism Harmony reward emblem */

.reward-emblem {
  position: relative;

  width: 105px;
  height: 135px;

  background: linear-gradient(
    135deg,
    #d1ffff 0%,
    #43dbe7 45%,
    #b55dda 100%
  );

  clip-path: polygon(
    50% 0%,
    90% 48%,
    50% 100%,
    10% 48%
  );

  filter: drop-shadow(0 0 15px #43dbe7);

  animation: reward-emblem-float 3s ease-in-out infinite;
}

.reward-emblem::after {
  content: "";

  position: absolute;
  inset: 12px;

  background: linear-gradient(
    145deg,
    rgba(255, 255, 255, 0.85),
    rgba(255, 255, 255, 0.05) 55%,
    rgba(37, 63, 117, 0.5)
  );

  clip-path: polygon(
    50% 0%,
    90% 48%,
    50% 100%,
    10% 48%
  );
}

@keyframes reward-emblem-float {
  0%, 100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-8px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .reward-emblem {
    animation: none;
  }
}

/* STEP 4-2G: 보상 화면 등장 애니메이션 */
#reward:not([hidden]) {
  animation: ornni-reward-enter 0.7s ease-out both;
}

@keyframes ornni-reward-enter {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.97);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  #reward:not([hidden]) {
    animation: none;
  }
}

/* STEP 4-2H: 보상 카드 등장 애니메이션 */
#reward:not([hidden]) .reward-card {
  animation: ornni-card-reveal 0.65s ease-out 0.2s both;
}

@keyframes ornni-card-reveal {
  from {
    opacity: 0;
    transform: scale(0.9);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  #reward:not([hidden]) .reward-card {
    animation: none;
  }
}

/* STEP 6-3L: Customer C 얼음 테마 보상 카드 테두리 */
#reward .reward-card {
  border: 1px solid transparent;

  background:
    linear-gradient(
      145deg,
      #152e4b 0%,
      #0b1930 100%
    ) padding-box,
    linear-gradient(
      135deg,
      #a9d8e9 0%,
      #80bdd8 50%,
      #477da6 100%
    ) border-box;

  box-shadow:
    0 0 18px rgba(105, 192, 231, 0.15),
    0 0 32px rgba(142, 210, 242, 0.1),
    inset 0 0 18px rgba(142, 210, 242, 0.05);
}

/* STEP 4-2K: 보상 화면 모바일 최적화 */
@media (max-width: 480px) {
  #reward {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    padding-inline: 16px;
  }

  #reward .reward-card {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin-inline: auto;
  }

  #reward #reward-name,
  #reward #reward-description {
    overflow-wrap: anywhere;
  }

  #reward #detail {
    box-sizing: border-box;
    min-height: 48px;
    max-width: 100%;
    touch-action: manipulation;
  }
}

/* STEP 4-3A: 서프라이즈 편지 모바일 최적화 */
@media (max-width: 480px) {
  #surprise {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    padding-inline: 16px;
  }

  #surprise .letter {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin-inline: auto;
  }

  #surprise .letter h2,
  #surprise .letter p {
    overflow-wrap: anywhere;
  }

  #surprise #restart {
    box-sizing: border-box;
    min-height: 48px;
    max-width: 100%;
    touch-action: manipulation;
  }
}

/* STEP 4-3B: 서프라이즈 편지 가독성 개선 */
#surprise .letter h2 {
  line-height: 1.45;
  margin-block: 12px 20px;
  text-wrap: balance;
}

#surprise #surprise-message {
  line-height: 1.9;
  margin-block: 0 20px;
  overflow-wrap: break-word;
}

#surprise .event-date,
#surprise .event-location {
  line-height: 1.7;
  margin-block: 6px;
}

/* STEP 6-3O: 고객 C 보상 화면 상단 레이블 얼음 테마 */
#reward .label {
  color: #a9d8e9;
  font-size: 12px;
  font-weight: bold;
  letter-spacing: 2px;
  line-height: 1.8;

  text-shadow:
    0 0 14px rgba(105, 192, 231, 0.3);

  overflow-wrap: anywhere;
}

/* STEP 6-3N: 고객 C 보상 이름 얼음빛 효과 */
#reward #reward-name {
  color: #e8f5ff;
  font-size: clamp(26px, 7vw, 38px);
  line-height: 1.4;

  text-shadow:
    0 0 14px rgba(169, 216, 233, 0.35),
    0 0 26px rgba(105, 192, 231, 0.2);
}

/* 보상 이름 아래 프리즘 구분선은 기존 스타일 유지 */

/* STEP 2-4A: Prism Harmony surprise letter */
.letter {
  position: relative;
  padding: 42px 28px;
  border: 2px solid #80bdd8;
  border-radius: 14px;

  background: linear-gradient(
    150deg,
    #1b3554 0%,
    #122744 55%,
    #0b1930 100%
  );

  color: #bdd9eb;
  line-height: 2;

  box-shadow:
    0 0 25px rgba(105, 192, 231, 0.18),
    0 0 35px rgba(142, 210, 242, 0.1);
}

.letter h2 { color: #e8f5ff; }

/* STEP 2-4B: Surprise letter typography */
/* FOR YOU 레이블 */
.letter > p:first-child {
  margin: 0 0 16px;

  color: #a9d8e9;
  font-size: 12px;
  font-weight: bold;
  letter-spacing: 4px;
}

/* 편지 제목 */
#surprise-title {
  margin: 0 auto 22px;
  max-width: 360px;

  color: #e8f5ff;
  font-size: clamp(13px, 3.5vw, 20px);
  font-weight: bold;
  line-height: 1.5;
  white-space: nowrap;

  text-shadow: 0 2px 12px rgba(129, 207, 245, 0.35);
}

/* 편지 메시지 */
#surprise-message {
  margin: 0 auto;
  max-width: 360px;

  color: #bdd9eb;
  font-family: "Malgun Gothic", sans-serif;
  font-size: clamp(14px, 3.8vw, 16px);
  font-weight: 400;
  line-height: 2;
  letter-spacing: 0.2px;

  white-space: pre-line;
  overflow-wrap: anywhere;
}


/* STEP 3-2D: Event date */
.event-date {
  margin: 24px auto 0;
  padding-top: 18px;

  border-top: 1px solid #d7acb9;

  color: #885b78;
  font-size: 14px;
  font-weight: bold;
  letter-spacing: 1px;
  line-height: 1.8;
}

.event-date[hidden] {
  display: none;
}

/* STEP 3-2F: Event location */
.event-location {
  margin: 10px auto 0;
  max-width: 360px;

  color: #885b78;
  font-size: 14px;
  font-weight: bold;
  line-height: 1.8;
  letter-spacing: 0.3px;
  overflow-wrap: anywhere;
}

.event-location[hidden] {
  display: none;
}

/* STEP 2-4C: Surprise letter reveal */
#surprise:not([hidden]) .letter {
  animation: prism-letter-reveal 0.85s
    cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes prism-letter-reveal {
  0% {
    opacity: 0;
    transform: translateY(28px) scale(0.94);
  }

  65% {
    opacity: 1;
    transform: translateY(-3px) scale(1.01);
  }

  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  #surprise:not([hidden]) .letter {
    animation: none;
  }
}

/* STEP 6-6C: 닫힌 얼음 상자 이미지 표시 */
.chest-image {
  opacity: 1;
}

/* STEP 6-3P: 고객 C 얼음 마법 빛 효과 */
.chest-glow {
  position: absolute;
  left: 50%;
  top: 45%;

  width: 110%;
  aspect-ratio: 1 / 1;

  border-radius: 50%;

  background: radial-gradient(
    circle,
    rgba(210, 245, 255, 0.85) 0%,
    rgba(120, 205, 255, 0.6) 25%,
    rgba(70, 125, 220, 0.35) 50%,
    transparent 72%
  );

  opacity: 0;
  transform: translate(-50%, -50%) scale(0.3);

  pointer-events: none;
  z-index: 1;
}

/* STEP 4-2E: 뚜껑 개봉 직후 빛 확산 */
.opening .chest-glow {
  animation: prism-glow-burst 1.2s ease-out 0.2s both;
}

/* STEP 6-6N: 후광 강도 및 확산 범위 조정 */
@keyframes prism-glow-burst {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.3);
  }

  25% {
    opacity: 0.35;
  }

  65% {
    opacity: 0.25;
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.15);
  }
}

/* 움직임 최소화 설정 */
@media (prefers-reduced-motion: reduce) {
  .opening .chest-glow {
    animation: none;
    opacity: 0.4;
    transform: translate(-50%, -50%) scale(1);
  }
}


/* STEP 2-2B: Prism Harmony star particles */


/* STEP 2-2B-1: Visible magical star particles */

.chest-particles {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}

.particle {
  position: absolute;
  left: 50%;
  top: 35%;

  width: 7px;
  height: 7px;

  background: #a9d8e9;
  color: #a9d8e9;

  opacity: 0;

  clip-path: polygon(
    50% 0%,
    62% 38%,
    100% 50%,
    62% 62%,
    50% 100%,
    38% 62%,
    0% 50%,
    38% 38%
  );
}

/* STEP 6-3Q: 밝은 얼음빛 별빛 */
.particle:nth-child(even) {
  background: #e8f5ff;
  color: #e8f5ff;
}

/* 별빛 주변의 발광 효과 */
.particle::after {
  content: "";
  position: absolute;
  inset: 0;
  background: inherit;
  filter: blur(5px);
}

/* 파티클 이동 방향 */
.particle:nth-child(1) {
  --x: -135px;
  --y: -110px;
}

.particle:nth-child(2) {
  --x: 120px;
  --y: -120px;
}

.particle:nth-child(3) {
  --x: -165px;
  --y: -30px;
}

.particle:nth-child(4) {
  --x: 155px;
  --y: -45px;
}

.particle:nth-child(5) {
  --x: -70px;
  --y: -155px;
}

.particle:nth-child(6) {
  --x: 75px;
  --y: -165px;
}

/* 상자 개봉 시 파티클 확산 */
.opening .particle {
  animation: prism-particle-burst 1.5s ease-out 0.3s both;
}

@keyframes prism-particle-burst {
  0% {
    opacity: 0;
    transform: translate(0, 0) scale(0.4);
  }

  20% {
    opacity: 0.6;
  }

  55% {
    opacity: 0.45;
    transform:
      translate(
        calc(var(--x) * 0.6),
        calc(var(--y) * 0.6)
      )
      scale(1);
  }

  100% {
    opacity: 0;
    transform:
      translate(var(--x), var(--y))
      scale(0.5);
  }
}

@media (prefers-reduced-motion: reduce) {
  .opening .particle {
    animation: none;
    opacity: 0;
  }
}

@keyframes float {
  50% { transform: translateY(-12px); }
}

@keyframes appear {
  from { opacity: 0; transform: scale(.9); }
  to { opacity: 1; transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}

/* STEP 4-7B: 모바일 가로 화면 공통 세로 여백 */
@media (orientation: landscape) and (max-height: 500px) {
  main {
    padding-block: 8px;
  }
}

/* STEP 4-6I-1: 모바일 가로 화면 첫 번째 상자 좌우 배치 */
@media (orientation: landscape) and (max-height: 500px) {
  #loot {
    width: min(100%, 640px);

    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas:
      "chest label"
      "chest title"
      "chest description"
      "chest button";

    column-gap: 18px;
    align-items: center;
  }

  #loot .label {
    grid-area: label;
    margin: 0;
  }

  #loot h1 {
    grid-area: title;
    font-size: 20px;
    line-height: 1.3;
    margin: 4px 0;
  }

  #loot .description {
    grid-area: description;
    font-size: 13px;
    line-height: 1.5;
    margin: 4px 0;
  }

  #loot .chest {
    grid-area: chest;
    width: min(100%, 240px);
    margin: 0 auto;
  }

  #loot #open {
    grid-area: button;
    width: 100%;
    padding: 12px 14px;
    margin: 6px 0 0;
  }
}

/* STEP 4-6J-4: 모바일 가로 화면 보상 좌우 배치 */
@media (orientation: landscape) and (max-height: 500px) {
  #reward {
    width: min(100%, 640px);
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 18px;
    align-items: center;
  }

  #reward .reward-visual {
    width: 100%;
    min-width: 0;
    padding: 12px;
  }

  #reward .reward-art {
    width: 100%;
    margin: 0;
  }

  #reward #reward-image {
    display: block;
  }

  #reward .reward-info {
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  #reward .reward-info > .label {
    margin: 0;
  }

  #reward #reward-name {
    font-size: 20px;
    line-height: 1.3;
  }

  #reward .reward-card {
    width: 100%;
  }

  #reward .reward-rarity {
    margin: 0 0 6px;
  }

  #reward .reward-card h2 {
    font-size: 15px;
    line-height: 1.3;
    margin: 0 0 6px;
  }

  #reward #reward-description {
    font-size: 12px;
    line-height: 1.5;
    margin: 0;
  }

  #reward #detail {
    width: 100%;
    margin: 0;
    padding: 12px 14px;
  }
}

/* STEP 4-6K-5: 모바일 가로 화면 편지 크기와 간격 조정 */
@media (orientation: landscape) and (max-height: 500px) {
  #surprise {
    width: min(100%, 580px);
  }

  #surprise .letter {
    width: 100%;
    padding: 12px 20px;
  }

  #surprise #restart {
    margin-top: 16px;
  }
}

/* STEP 4-6H-1: 모바일 가로 화면 보상 카드 최적화 */
@media (orientation: landscape) and (max-height: 500px) {
  #reward #reward-name {
    margin: 6px auto 10px;
    padding-bottom: 8px;
  }

  #reward .reward-card {
    margin: 10px auto;
    padding: 14px;
  }

  #reward .reward-art {
    height: 180px;
    margin-bottom: 8px;
  }

  #reward #reward-image {
    width: 100%;
    height: 100%;
    max-height: none;
    object-fit: contain;
  }
}

/* STEP 5-1K: 서프라이즈 편지 날짜·장소 아이콘 */
/* 날짜 앞 달력 아이콘 */
#surprise-date::before {
  content: "";
  display: inline-block;
  width: 16px;
  height: 16px;
  margin-right: 8px;
  vertical-align: -3px;

  background-color: currentColor;

  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='16' rx='2'/%3E%3Cpath d='M7 3v4M17 3v4M3 10h18'/%3E%3C/svg%3E") center / contain no-repeat;

  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='16' rx='2'/%3E%3Cpath d='M7 3v4M17 3v4M3 10h18'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* 장소 앞 위치 아이콘 */
#surprise-location::before {
  content: "";
  display: inline-block;
  width: 16px;
  height: 16px;
  margin-right: 8px;
  vertical-align: -3px;

  background-color: currentColor;

  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 10c0 5-8 11-8 11S4 15 4 10a8 8 0 1 1 16 0Z'/%3E%3Ccircle cx='12' cy='10' r='2.5'/%3E%3C/svg%3E") center / contain no-repeat;

  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 10c0 5-8 11-8 11S4 15 4 10a8 8 0 1 1 16 0Z'/%3E%3Ccircle cx='12' cy='10' r='2.5'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* =========================================
   STEP 6-6H: 고객 C 이미지 기반 얼음 균열
   ========================================= */

/* 균열 효과를 상자 위에 겹쳐 표시 */
#loot .chest {
  isolation: isolate;
}

/* 균열 이미지 */
#loot .chest::after {
  content: "";
  position: absolute;
  inset: 0;

  z-index: 5;
  pointer-events: none;

  background-image:
    url("../assets/chests/ice-seal/ice_cracks.png");

  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;

  opacity: 0;
  transform: scale(0.25);
  transform-origin: center;

  filter:
    drop-shadow(0 0 8px rgba(120, 220, 255, 0.9))
    drop-shadow(0 0 18px rgba(70, 170, 255, 0.6));
}

/* 버튼 클릭 후 균열 확산 */
#loot.opening .chest::after {
  animation: frost-crack-image 1.3s ease-out forwards;
}

@keyframes frost-crack-image {
  0% {
    opacity: 0;
    transform: scale(0.25);
  }

  20% {
    opacity: 0.9;
  }

  65% {
    opacity: 1;
    transform: scale(1);
  }

  100% {
    opacity: 0;
    transform: scale(1.12);
  }
}

/* 움직임 최소화 설정 */
@media (prefers-reduced-motion: reduce) {
  #loot.opening .chest::after {
    animation: none;
    opacity: 0;
  }
}

/* =========================================
   STEP 6-6J: 얼음 봉인 상자 소멸 효과
   ========================================= */

/* 평소에는 기존 상자 애니메이션 유지 */
#loot .chest-image {
  transform-origin: center center;
}

/* 개봉 시 상자가 빛 속으로 사라지는 효과 */
#loot.opening .chest-image {
  animation: frost-chest-dissolve 1.8s ease-in forwards;
}

@keyframes frost-chest-dissolve {
  0% {
    opacity: 1;
    transform: scale(1);
    filter: brightness(1);
  }

  45% {
    opacity: 1;
    transform: scale(1);
    filter: brightness(1.1);
  }

  65% {
    opacity: 1;
    transform: scale(1.025);
    filter: brightness(1.8);
  }

  82% {
    opacity: 0.35;
    transform: scale(1.055);
    filter: brightness(2.8) blur(3px);
  }

  100% {
    opacity: 0;
    transform: scale(1.08);
    filter: brightness(3) blur(8px);
  }
}

/* 움직임 최소화 설정 */
@media (prefers-reduced-motion: reduce) {
  #loot.opening .chest-image {
    animation: none;
  }
}

#loot .chest::before {
  content: "";
  position: absolute;
  inset: 0;
  transform-origin: center;

  background-image:
    url("../assets/chests/ice-seal/ice_flash.png");

  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;

  opacity: 0;
  transform: scale(0.6);
  filter: brightness(1.3);

  z-index: 6;
  pointer-events: none;
}

/* 균열 이후 섬광이 순간적으로 확산 */
#loot.opening .chest::before {
  animation: frost-flash-burst 0.65s ease-out 1.05s both;
}

@keyframes frost-flash-burst {
  0% {
    opacity: 0;
    transform: scale(0.6);
  }

  25% {
    opacity: 1;
    transform: scale(0.9);
  }

  55% {
    opacity: 0.95;
    transform: scale(1.15);
  }

  100% {
    opacity: 0;
    transform: scale(1.35);
  }
}

/* 움직임 최소화 설정 */
@media (prefers-reduced-motion: reduce) {
  #loot.opening .chest::before {
    animation: none;
    opacity: 0;
  }
}