@charset "UTF-8";

.dice-page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 8px 0 40px;
}

/* 상단 */

.dice-page .utility-top {
  padding: 32px 20px 28px;
  text-align: center;
}

.dice-page .utility-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  padding: 6px 14px;
  border-radius: 999px;
  background: #ecfeff;
  color: #155e75;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.dice-page .utility-title {
  margin: 0;
  color: #0f172a;
  font-size: clamp(34px, 4vw, 46px);
  font-weight: 900;
  letter-spacing: -0.04em;
}

.dice-page .utility-desc {
  max-width: 860px;
  margin: 16px auto 0;
  color: #64748b;
  font-size: 15px;
  line-height: 1.8;
}

/* 요약 카드 */

.dice-summary-card {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.dice-summary-item {
  padding: 22px;
  border-radius: 22px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.06);
}

.dice-summary-item::before {
  content: "";
  display: block;
  width: 34px;
  height: 4px;
  margin-bottom: 14px;
  border-radius: 999px;
  background: linear-gradient(90deg, #06b6d4, #2563eb);
}

.dice-summary-item strong {
  display: block;
  margin-bottom: 8px;
  color: #0f172a;
  font-size: 15px;
  font-weight: 900;
}

.dice-summary-item span {
  color: #64748b;
  font-size: 13px;
  line-height: 1.7;
}

/* 메인 카드 */

.dice-card {
  padding: 30px;
  margin-bottom: 28px;
  border-radius: 28px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  background: #ffffff;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.08);
}

.dice-card-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 26px;
}

.dice-card-head h2 {
  margin: 0 0 8px;
  color: #0f172a;
  font-size: 24px;
  font-weight: 900;
  letter-spacing: -0.03em;
}

.dice-card-head p {
  margin: 0;
  color: #64748b;
  font-size: 14px;
  line-height: 1.7;
}

.dice-status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 90px;
  padding: 9px 14px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

/* 레이아웃 */

.dice-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.6fr);
  gap: 20px;
}

/* 결과 카드 */

.dice-result-card {
  padding: 24px;
  border-radius: 24px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background:
    radial-gradient(circle at top left, rgba(6, 182, 212, 0.08), transparent 34%),
    linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.dice-result-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.dice-result-label {
  color: #0f172a;
  font-size: 15px;
  font-weight: 900;
}

.dice-roll-count {
  color: #94a3b8;
  font-size: 12px;
  font-weight: 800;
}

.dice-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 16px;
  perspective: 900px;
}

/* 주사위 */

.dice-face {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 24px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background:
    radial-gradient(circle at 28% 22%, rgba(255,255,255,0.96), transparent 32%),
    linear-gradient(145deg, #ffffff 0%, #f8fafc 56%, #e2e8f0 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.9),
    inset -8px -10px 18px rgba(15, 23, 42, 0.05),
    0 16px 30px rgba(15, 23, 42, 0.1);
  transform-style: preserve-3d;
  transition:
    transform 0.22s ease,
    box-shadow 0.22s ease,
    border-color 0.22s ease;
}

.dice-face::before {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.72);
  pointer-events: none;
}

.dice-face::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.34), transparent 42%);
  pointer-events: none;
}

.dice-face:hover {
  transform: translateY(-3px) rotateX(4deg) rotateY(-4deg);
  border-color: rgba(6, 182, 212, 0.26);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.9),
    inset -8px -10px 18px rgba(15, 23, 42, 0.05),
    0 22px 42px rgba(15, 23, 42, 0.14);
}

.dice-face.rolling {
  animation: diceRoll 0.68s cubic-bezier(0.22, 0.85, 0.24, 1) both;
}

.dice-face.rolling .dice-dot {
  filter: blur(1px);
}

@keyframes diceRoll {
  0% {
    transform: rotate(0deg) rotateX(0deg) rotateY(0deg) scale(1);
  }

  18% {
    transform: rotate(80deg) rotateX(24deg) rotateY(-18deg) scale(1.08);
  }

  36% {
    transform: rotate(165deg) rotateX(-20deg) rotateY(18deg) scale(0.96);
  }

  54% {
    transform: rotate(245deg) rotateX(18deg) rotateY(-24deg) scale(1.07);
  }

  76% {
    transform: rotate(325deg) rotateX(-10deg) rotateY(16deg) scale(0.99);
  }

  100% {
    transform: rotate(360deg) rotateX(0deg) rotateY(0deg) scale(1);
  }
}

/* 빈 상태 */

.dice-empty {
  display: flex;
  align-items: center;
  justify-content: center;
}

.dice-empty span {
  color: #cbd5e1;
  font-size: 34px;
  font-weight: 900;
}

/* 주사위 점 */

.dice-dot {
  position: absolute;
  z-index: 2;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, #334155 0%, #0f172a 58%, #020617 100%);
  box-shadow:
    inset 0 1px 2px rgba(255,255,255,0.16),
    0 2px 6px rgba(15, 23, 42, 0.22);
}

.dot-center {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.dot-top-left {
  top: 18%;
  left: 18%;
}

.dot-top-right {
  top: 18%;
  right: 18%;
}

.dot-middle-left {
  top: 50%;
  left: 18%;
  transform: translateY(-50%);
}

.dot-middle-right {
  top: 50%;
  right: 18%;
  transform: translateY(-50%);
}

.dot-bottom-left {
  bottom: 18%;
  left: 18%;
}

.dot-bottom-right {
  right: 18%;
  bottom: 18%;
}

/* 결과 요약 */

.dice-summary-box {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 22px;
}

.dice-summary-box div {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(248, 250, 252, 0.92);
  text-align: center;
}

.dice-summary-box span {
  display: block;
  margin-bottom: 8px;
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
}

.dice-summary-box strong {
  color: #0f172a;
  font-size: 22px;
  font-weight: 900;
}

/* 컨트롤 */

.dice-control-card {
  padding: 24px;
  border-radius: 24px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.dice-page .utility-field-label {
  display: block;
  margin-bottom: 10px;
  color: #0f172a;
  font-weight: 900;
}

.dice-select {
  width: 100%;
  height: 54px;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: #ffffff;
  color: #0f172a;
  font-size: 15px;
}

.dice-select:focus {
  outline: none;
  border-color: #38bdf8;
  box-shadow: 0 0 0 4px rgba(6, 182, 212, 0.12);
}

/* 빠른 선택 버튼 */

.dice-quick-box,
.dice-roll-preset-box {
  display: grid;
  gap: 10px;
}

.dice-quick-box {
  grid-template-columns: repeat(4, 1fr);
  margin-top: 18px;
}

.dice-roll-preset-box {
  grid-template-columns: repeat(4, 1fr);
  margin-top: 12px;
}

.dice-preset-label {
  margin-top: 22px;
}

.dice-quick-btn,
.dice-roll-preset {
  height: 44px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 14px;
  background: #ffffff;
  color: #334155;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition:
    transform 0.2s ease,
    border-color 0.2s ease,
    background 0.2s ease,
    box-shadow 0.2s ease;
}

.dice-quick-btn:hover,
.dice-roll-preset:hover {
  transform: translateY(-1px);
  border-color: rgba(6, 182, 212, 0.35);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

.dice-quick-btn.is-active,
.dice-roll-preset.is-active {
  border-color: rgba(6, 182, 212, 0.42);
  background: #ecfeff;
  color: #155e75;
}

/* 버튼 */

.dice-btn-row {
  margin-top: 22px;
}

.dice-page .utility-btn {
  min-height: 48px;
  padding: 0 20px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 800;
}

.dice-page .utility-btn-primary {
  border-color: #0f172a;
  background: linear-gradient(135deg, #0f172a, #164e63);
  color: #ffffff;
}

.dice-page .utility-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.16);
}

.dice-page .utility-btn:disabled,
.dice-quick-btn:disabled,
.dice-roll-preset:disabled {
  cursor: not-allowed;
  opacity: 0.62;
  transform: none;
  box-shadow: none;
}

/* 메시지 */

.dice-message {
  margin-top: 18px;
  padding: 18px;
  border-radius: 18px;
  border: 1px solid rgba(6, 182, 212, 0.16);
  background: linear-gradient(135deg, #ecfeff, #eff6ff);
  color: #155e75;
  font-size: 14px;
  line-height: 1.7;
}

/* 기록 영역 */

.dice-history-card {
  margin-top: 24px;
  padding: 24px;
  border-radius: 24px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.dice-history-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.dice-history-head h3 {
  margin: 0 0 6px;
  color: #0f172a;
  font-size: 20px;
  font-weight: 900;
}

.dice-history-head p {
  margin: 0;
  color: #64748b;
  font-size: 14px;
  line-height: 1.7;
}

.dice-history-clear {
  flex: 0 0 auto;
  height: 42px;
  padding: 0 16px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 14px;
  background: #ffffff;
  color: #475569;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    transform 0.2s ease;
}

.dice-history-clear:hover {
  transform: translateY(-1px);
  border-color: rgba(6, 182, 212, 0.28);
  background: #f8fafc;
}

.dice-history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 620px;
  overflow-y: auto;
  padding-right: 4px;
}

.dice-history-list::-webkit-scrollbar {
  width: 8px;
}

.dice-history-list::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.36);
}

.dice-history-empty {
  padding: 24px;
  border-radius: 18px;
  border: 1px dashed rgba(148, 163, 184, 0.26);
  background: #f8fafc;
  color: #94a3b8;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
}

.dice-history-item {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr) 90px;
  gap: 16px;
  align-items: center;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: #ffffff;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.04);
}

.dice-history-round {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  border-radius: 14px;
  background: #ecfeff;
  color: #155e75;
  font-size: 13px;
  font-weight: 900;
}

.dice-history-values {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dice-history-chip {
  padding: 8px 12px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #334155;
  font-size: 13px;
  font-weight: 800;
}

.dice-history-total {
  text-align: right;
}

.dice-history-total span {
  display: block;
  margin-bottom: 4px;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 700;
}

.dice-history-total strong {
  color: #0f172a;
  font-size: 22px;
  font-weight: 900;
}

/* 도움말 */

.dice-page .help-panel {
  margin-top: 34px;
}

.dice-page .help-panel > h2 {
  margin: 0 0 18px;
  color: #0f172a;
  font-size: 28px;
  font-weight: 900;
  letter-spacing: -0.03em;
}

.dice-page .help-box {
  border-radius: 22px;
}

.dice-page .help-toggle-box summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  cursor: pointer;
  list-style: none;
  color: #0f172a;
  font-size: 1.06rem;
  font-weight: 800;
}

.dice-page .help-toggle-box summary::-webkit-details-marker {
  display: none;
}

.dice-page .help-toggle-box summary::after {
  content: "+";
  flex: 0 0 auto;
  color: #64748b;
  font-size: 1.2rem;
  font-weight: 700;
}

.dice-page .help-toggle-box[open] summary::after {
  content: "−";
}

.dice-page .help-toggle-content {
  margin-top: 14px;
}

.dice-page .help-toggle-content p {
  margin: 0;
  color: #334155;
  line-height: 1.8;
}

/* 반응형 */

@media (max-width: 980px) {
  .dice-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .dice-page {
    padding-bottom: 28px;
  }

  .dice-page .utility-top {
    padding: 24px 14px 20px;
  }

  .dice-summary-card {
    grid-template-columns: 1fr;
  }

  .dice-card {
    padding: 22px;
    border-radius: 22px;
  }

  .dice-card-head {
    grid-template-columns: 1fr;
  }

  .dice-board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dice-summary-box {
    grid-template-columns: 1fr;
  }

  .dice-quick-box,
  .dice-roll-preset-box {
    grid-template-columns: repeat(2, 1fr);
  }

  .dice-history-head {
    flex-direction: column;
    align-items: stretch;
  }

  .dice-history-item {
    grid-template-columns: 1fr;
  }

  .dice-history-total {
    text-align: left;
  }

  .dice-page .utility-btn,
  .dice-btn-row {
    width: 100%;
  }

  .dice-page .utility-title {
    font-size: 32px;
  }
}

@media (max-width: 480px) {
  .dice-dot {
    width: 14px;
    height: 14px;
  }
}