/* Random Tools Component Styles */

/* ── 1. 랜덤 숫자 생성기 ── */
.randnum-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  height: 48px;
  padding: 0 10px;
  background-color: #ebf5fe;
  color: #2383e2;
  border: 1px solid rgba(35, 131, 226, 0.25);
  border-radius: 50%;
  font-size: 1.3rem;
  font-weight: 700;
  font-family: var(--font-mono, monospace);
  box-shadow: 0 2px 6px rgba(35, 131, 226, 0.1);
  animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

@keyframes popIn {
  from { transform: scale(0.6); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}


/* ── 2. 사다리 타기 ── */
#ladder-canvas {
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.05);
}

.ladder-input-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ladder-input-group input {
  padding: 8px 12px;
  font-size: 0.85rem;
}


/* ── 3. 3D 주사위 던지기 ── */
/* 3D Scene Container */
.dice-scene {
  width: 64px;
  height: 64px;
  perspective: 600px;
}

/* 3D Cube */
.dice-cube {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 1.2s cubic-bezier(0.2, 0.8, 0.3, 1);
}

/* 주사위 면 기본 스타일 */
.dice-face {
  position: absolute;
  width: 64px;
  height: 64px;
  background-color: #ffffff;
  border: 2px solid #e9e9e6;
  border-radius: 12px;
  display: grid;
  grid-template: repeat(3, 1fr) / repeat(3, 1fr);
  padding: 6px;
  box-sizing: border-box;
  backface-visibility: hidden;
  box-shadow: inset 0 0 10px rgba(0,0,0,0.1), 0 2px 5px rgba(0,0,0,0.05);
}

/* 주사위 점 */
.dice-dot {
  width: 8px;
  height: 8px;
  background-color: #37352f;
  border-radius: 50%;
  align-self: center;
  justify-self: center;
}

/* 1번 눈금의 중앙 빨간점 */
.face-1 .dice-dot {
  background-color: #d13735;
  width: 14px;
  height: 14px;
}

/* 주사위 6면의 3D 공간 배치 (translateZ는 너비의 절반인 32px) */
.face-1 { transform: rotateY(0deg) translateZ(32px); }
.face-6 { transform: rotateY(180deg) translateZ(32px); }
.face-3 { transform: rotateY(90deg) translateZ(32px); }
.face-4 { transform: rotateY(-90deg) translateZ(32px); }
.face-2 { transform: rotateX(90deg) translateZ(32px); }
.face-5 { transform: rotateX(-90deg) translateZ(32px); }

/* 주사위 눈 배치용 그리드 템플릿 */
/* 1: 중앙 */
.face-1 { display: flex; justify-content: center; align-items: center; }

/* 2: 좌상, 우하 */
.face-2 .dice-dot:nth-child(1) { grid-area: 1 / 1; }
.face-2 .dice-dot:nth-child(2) { grid-area: 3 / 3; }

/* 3: 좌상, 중앙, 우하 */
.face-3 .dice-dot:nth-child(1) { grid-area: 1 / 1; }
.face-3 .dice-dot:nth-child(2) { grid-area: 2 / 2; }
.face-3 .dice-dot:nth-child(3) { grid-area: 3 / 3; }

/* 4: 네 모퉁이 */
.face-4 .dice-dot:nth-child(1) { grid-area: 1 / 1; }
.face-4 .dice-dot:nth-child(2) { grid-area: 1 / 3; }
.face-4 .dice-dot:nth-child(3) { grid-area: 3 / 1; }
.face-4 .dice-dot:nth-child(4) { grid-area: 3 / 3; }

/* 5: 네 모퉁이 + 중앙 */
.face-5 .dice-dot:nth-child(1) { grid-area: 1 / 1; }
.face-5 .dice-dot:nth-child(2) { grid-area: 1 / 3; }
.face-5 .dice-dot:nth-child(3) { grid-area: 2 / 2; }
.face-5 .dice-dot:nth-child(4) { grid-area: 3 / 1; }
.face-5 .dice-dot:nth-child(5) { grid-area: 3 / 3; }

/* 6: 좌우 기둥 3개씩 */
.face-6 .dice-dot:nth-child(1) { grid-area: 1 / 1; }
.face-6 .dice-dot:nth-child(2) { grid-area: 2 / 1; }
.face-6 .dice-dot:nth-child(3) { grid-area: 3 / 1; }
.face-6 .dice-dot:nth-child(4) { grid-area: 1 / 3; }
.face-6 .dice-dot:nth-child(5) { grid-area: 2 / 3; }
.face-6 .dice-dot:nth-child(6) { grid-area: 3 / 3; }

/* 굴러가는 3D 무작위 회전 쉐이크 애니메이션 */
.dice-cube.rolling-animation {
  animation: spinCrazy 1.2s ease-in-out;
}

@keyframes spinCrazy {
  0% { transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg); }
  15% { transform: rotateX(180deg) rotateY(90deg) rotateZ(45deg); }
  30% { transform: rotateX(360deg) rotateY(270deg) rotateZ(180deg); }
  45% { transform: rotateX(540deg) rotateY(180deg) rotateZ(90deg); }
  60% { transform: rotateX(720deg) rotateY(450deg) rotateZ(270deg); }
  75% { transform: rotateX(900deg) rotateY(360deg) rotateZ(180deg); }
  90% { transform: rotateX(990deg) rotateY(450deg) rotateZ(360deg); }
  100% { transform: rotateX(1080deg) rotateY(540deg) rotateZ(450deg); }
}
