/* ===== Play4up — Dice styles v3 ===== */

/* catalog card placeholder cover (neutral gradient, no external brand) */
.art.art-dice {
  background: radial-gradient(120% 120% at 30% 20%, #2b3350 0%, #171a2b 55%, #0e1120 100%);
  display: flex; align-items: center; justify-content: center;
  font-size: 34px;
}

#screen-dice { background: #0b0c0f; overflow-x: hidden; }
#dice-root { width: 100%; }

.dc-wrap {
  --dc-green: #2fd07a;
  --dc-green2: #1fa860;
  --dc-red: #ff4d5e;
  --dc-red2: #d3283a;
  --dc-blue: #4c7bff;
  --dc-card: #12141f;
  --dc-card2: #171a28;
  --dc-line: #232741;
  box-sizing: border-box;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 54px) 12px calc(env(safe-area-inset-bottom, 0px) + 16px);
  display: flex; flex-direction: column; gap: 12px;
  font-family: "Manrope", system-ui, sans-serif;
  touch-action: pan-y; overscroll-behavior: contain;
}
.dc-wrap *, .dc-wrap *::before, .dc-wrap *::after { box-sizing: border-box; }

.dc-topbar { display: flex; align-items: center; justify-content: space-between; padding: 0 4px; }
.dc-title { font-family: "Russo One", sans-serif; font-size: 22px; color: #fff; letter-spacing: .5px; }
.dc-bal {
  font-weight: 800; color: #ffd84d; font-size: 15px;
  background: rgba(255,216,77,.1); border: 1px solid rgba(255,216,77,.25);
  padding: 6px 12px; border-radius: 999px; max-width: 55%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dc-bal::after { content: " $"; opacity: .7; }

.dc-card {
  background: linear-gradient(180deg, var(--dc-card2), var(--dc-card));
  border: 1px solid var(--dc-line);
  border-radius: 22px;
  padding: 16px;
  min-width: 0;
}

/* ---------- board ---------- */
.dc-board { position: relative; overflow: hidden; }

.dc-num {
  position: relative; z-index: 2;
  text-align: center;
  font-family: "Manrope", system-ui, sans-serif;
  font-weight: 800;
  font-size: clamp(30px, 10vw, 44px);
  line-height: 1.1;
  color: #dfe6f5;
  padding: 6px 0 12px;
  font-variant-numeric: tabular-nums;
  letter-spacing: .5px;
  text-shadow: 0 2px 10px rgba(0,0,0,.35);
}
.dc-num.win { color: var(--dc-green); }
.dc-num.lose { color: var(--dc-red); }
.dc-num.rolling { color: #eaf0ff; opacity: .95; }

.dc-slider { position: relative; z-index: 2; padding: 6px 0 0; }
.dc-track {
  position: relative;
  height: 16px;
  border-radius: 999px;
  background: #0e1120;
  border: 1px solid var(--dc-line);
  margin: 22px 0 6px;
  touch-action: none;
  cursor: pointer;
  overflow: visible;
}
.dc-track.locked { cursor: default; }
.dc-zone { position: absolute; top: 3px; bottom: 3px; border-radius: 999px; }
.dc-green { background: linear-gradient(90deg, var(--dc-green2), var(--dc-green)); }
.dc-red { background: linear-gradient(90deg, var(--dc-red), var(--dc-red2)); }

.dc-handle {
  position: absolute; top: 50%; left: 48.5%;
  transform: translate(-50%, -50%);
  width: 30px; height: 30px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #6d92ff, var(--dc-blue));
  border: 3px solid #0b0c0f;
  box-shadow: 0 4px 14px rgba(76,123,255,.5);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 900; font-size: 11px; letter-spacing: -1px;
  z-index: 5; pointer-events: none;
}

/* result pin (moves via transform only) */
.dc-pin {
  position: absolute; top: -20px; left: 0;
  width: 0; height: 0; z-index: 6;
  will-change: transform;
}
.dc-pin i {
  position: absolute; left: -9px; top: 0;
  width: 18px; height: 18px; border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  background: #fff; border: 3px solid #fff;
  box-shadow: 0 3px 8px rgba(0,0,0,.4);
}
.dc-pin.win i { background: var(--dc-green); }
.dc-pin.lose i { background: var(--dc-red); }
.dc-dot {
  position: absolute; top: 50%; left: 0; margin-top: -3px; margin-left: -3px;
  width: 6px; height: 6px; border-radius: 50%; background: #fff; z-index: 6;
  will-change: transform; box-shadow: 0 0 6px rgba(255,255,255,.8);
}

.dc-scale {
  display: flex; justify-content: space-between;
  color: #6b7290; font-size: 12px; font-weight: 700; padding: 0 2px;
}

/* ---------- history ---------- */
.dc-hist {
  display: block; margin-top: 14px;
  overflow: hidden;
  min-width: 0; padding-bottom: 2px;
}
.dc-hist-track { display: flex; gap: 8px; will-change: transform; }
.dc-hist-empty { color: #6b7290; font-size: 13px; padding: 4px 2px; }
.dc-hchip {
  flex: 0 0 auto;
  min-width: 60px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-weight: 800; font-size: 14px; font-variant-numeric: tabular-nums;
  color: #fff; cursor: pointer;
  font-family: inherit;
}
.dc-hchip.w { background: rgba(47,208,122,.16); border-color: rgba(47,208,122,.4); color: var(--dc-green); }
.dc-hchip.l { background: rgba(255,77,94,.14); border-color: rgba(255,77,94,.38); color: var(--dc-red); }

/* ---------- panel ---------- */
.dc-panel { display: flex; flex-direction: column; gap: 12px; }
.dc-lab, .dc-flab { color: #8b90ad; font-size: 13px; font-weight: 700; }
.dc-betrow { display: flex; gap: 10px; align-items: stretch; }
.dc-betbtn {
  flex: 0 0 auto; width: 58px; min-width: 58px;
  background: #0e1120; border: 1px solid var(--dc-line); border-radius: 14px;
  color: #fff; font-weight: 900; font-size: 16px; font-family: inherit;
  cursor: pointer; outline: none;
  font-variant-numeric: tabular-nums;
}
.dc-betbtn:active { transform: translateY(1px); }
.dc-betbtn:disabled { opacity: .7; }
.dc-input {
  width: 100%; min-width: 0;
  background: #0e1120; border: 1px solid var(--dc-line); border-radius: 14px;
  color: #fff; font-weight: 800; font-size: 18px; font-family: inherit;
  padding: 14px 16px; outline: none;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
}
.dc-input:focus { border-color: var(--dc-blue); }
.dc-bet { flex: 1 1 auto; }
.dc-play {
  display: block; width: 100%; max-width: 300px;
  margin: 4px auto 0;
  border: none; border-radius: 14px;
  background: linear-gradient(180deg, #37e08a, #1fa860);
  color: #05230f; font-weight: 900; font-size: 17px; font-family: inherit;
  padding: 15px 22px; cursor: pointer;
  box-shadow: 0 6px 18px rgba(31,168,96,.4);
}
.dc-play:active { transform: translateY(1px); }
.dc-play:disabled { opacity: .6; cursor: default; }
.dc-play.loading { position: relative; color: transparent; }
.dc-play.loading::after {
  content: ""; position: absolute; top: 50%; left: 50%;
  width: 20px; height: 20px; margin: -10px 0 0 -10px;
  border: 3px solid rgba(5,35,15,.35); border-top-color: #05230f;
  border-radius: 50%; animation: dcSpin2 .7s linear infinite;
}
@keyframes dcSpin2 { to { transform: rotate(360deg); } }

.dc-moderow { display: flex; gap: 10px; }
.dc-mode {
  flex: 1 1 auto; min-width: 0;
  background: #0e1120; border: 1px solid var(--dc-line); border-radius: 14px;
  color: #fff; font-weight: 800; font-size: 17px; font-family: inherit;
  padding: 14px 16px; cursor: pointer; text-align: center;
}
.dc-swap {
  flex: 0 0 auto; width: 54px;
  background: #0e1120; border: 1px solid var(--dc-line); border-radius: 14px;
  color: var(--dc-blue); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.dc-swap svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.dc-swap:active { transform: translateY(1px); }

.dc-fields { display: flex; gap: 10px; }
.dc-field { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 6px; }

.dc-mode:disabled, .dc-swap:disabled, .dc-input[readonly] { opacity: .7; }

/* ---------- message ---------- */
.dc-msg {
  min-height: 0; max-height: 0; overflow: hidden; opacity: 0;
  transition: opacity .2s, max-height .2s, margin .2s;
  text-align: center; font-weight: 800; font-size: 15px; border-radius: 12px;
  margin: 0 4px;
}
.dc-msg.show { max-height: 120px; opacity: 1; padding: 10px 14px; margin: 0 4px; }
.dc-msg.win { background: rgba(47,208,122,.15); color: var(--dc-green); }
.dc-msg.lose { background: rgba(255,77,94,.14); color: var(--dc-red); }
.dc-msg.retry { background: rgba(76,123,255,.14); color: #a9c0ff; }
.dc-msg-btn {
  display: inline-block; margin-left: 10px;
  background: var(--dc-blue); color: #fff; border: none; border-radius: 10px;
  padding: 6px 14px; font-weight: 800; font-family: inherit; cursor: pointer;
}

/* ---------- bottom sheet ---------- */
.dc-sheet-wrap { position: fixed; inset: 0; z-index: 60; display: none; }
.dc-sheet-wrap.show { display: block; }
.dc-sheet-back { position: absolute; inset: 0; background: rgba(0,0,0,.55); }
.dc-sheet {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: linear-gradient(180deg, #1a1e2e, #12141f);
  border-radius: 22px 22px 0 0; border-top: 1px solid var(--dc-line);
  padding: 12px 18px calc(env(safe-area-inset-bottom, 0px) + 20px);
  max-width: 560px; margin: 0 auto;
  animation: dcSheetUp .22s ease;
}
@keyframes dcSheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.dc-sheet-grip { width: 44px; height: 5px; border-radius: 999px; background: #333a55; margin: 2px auto 12px; }
.dc-sheet-num { text-align: center; font-family: "Russo One", sans-serif; font-size: 40px; margin-bottom: 12px; }
.dc-sheet-num.win { color: var(--dc-green); }
.dc-sheet-num.lose { color: var(--dc-red); }
.dc-sheet-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-top: 1px solid var(--dc-line); gap: 12px; }
.dc-sheet-row span { color: #8b90ad; font-size: 14px; flex: 0 0 auto; }
.dc-sheet-row b { color: #fff; font-size: 14px; font-weight: 800; text-align: right; word-break: break-all; min-width: 0; }
.dc-sheet-close {
  width: 100%; margin-top: 16px; border: none; border-radius: 14px;
  background: #232741; color: #fff; font-weight: 800; font-size: 16px; font-family: inherit;
  padding: 14px; cursor: pointer;
}

/* ---------- responsive ---------- */
@media (max-width: 360px) {
  .dc-play { max-width: 100%; padding: 14px 18px; font-size: 16px; }
  .dc-input { font-size: 16px; padding: 12px 12px; }
  .dc-betbtn { width: 50px; min-width: 50px; font-size: 15px; }
  .dc-num { font-size: clamp(26px, 9vw, 38px); }
  .dc-handle { width: 26px; height: 26px; }
}
@media (max-height: 640px) {
  .dc-num { padding: 4px 0 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .dc-sheet { animation: none; }
  .dc-play.loading::after { animation-duration: 1.4s; }
}
