.dice-roll-marker {
  position: absolute;
  z-index: 6;
  top: -12px;
  width: 3px;
  height: 52px;
  transform: translateX(-50%);
  border-radius: 4px;
  background: #151820;
  pointer-events: none;
}

.dice-roll-marker[hidden] { display: none; }

.dice-roll-marker::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -2px;
  width: 11px;
  height: 11px;
  transform: translateX(-50%);
  border: 3px solid #fff;
  border-radius: 50%;
  background: #151820;
  box-shadow: 0 2px 7px #0004;
}

.dice-roll-marker span {
  position: absolute;
  left: 50%;
  top: -29px;
  min-width: 37px;
  padding: 4px 8px;
  transform: translateX(-50%);
  border-radius: 9px;
  background: #151820;
  box-shadow: 0 4px 10px #0003;
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
}

@media (min-width: 701px) {
  .game-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .game-tile[data-feature="Batu, Gunting, Kertas"] > span:not(.online-badge) {
    min-width: 0;
    font-size: 21px;
    letter-spacing: -0.35px;
  }
}

.purchase-modal {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(16, 18, 25, .48);
  backdrop-filter: blur(7px);
}

.purchase-modal[hidden],
.purchase-step[hidden] {
  display: none;
}

.purchase-dialog {
  position: relative;
  width: min(100%, 470px);
  padding: 34px;
  border: 1px solid #f0dfe1;
  border-radius: 26px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(34, 20, 24, .2);
}

.purchase-close {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: #f7f2f3;
  color: #34363d;
  font-size: 25px;
  cursor: pointer;
}

.purchase-step h2 {
  margin: 0 36px 10px 0;
  color: #11141c;
  font-size: 27px;
}

.purchase-step > p {
  margin: 0 0 22px;
  color: #63656d;
  font-size: 15px;
  line-height: 1.55;
}

.purchase-step label {
  display: grid;
  gap: 8px;
  color: #292c34;
  font-size: 14px;
  font-weight: 750;
}

.purchase-step input {
  width: 100%;
  height: 50px;
  padding: 0 15px;
  border: 1.5px solid #dedcdf;
  border-radius: 13px;
  outline: none;
  color: #151820;
  background: #fff;
  font: inherit;
  font-size: 16px;
}

.purchase-step input:focus {
  border-color: #f0263a;
  box-shadow: 0 0 0 4px rgba(240, 38, 58, .1);
}

.purchase-error {
  display: block;
  min-height: 20px;
  margin-top: 6px;
  color: #df1428;
  font-size: 13px;
}

.purchase-actions {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  gap: 10px;
  margin-top: 13px;
}

.purchase-actions button,
.purchase-resend {
  min-height: 46px;
  border: 0;
  border-radius: 13px;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
}

.purchase-cancel,
.purchase-back,
.purchase-resend {
  background: #f1eff0;
  color: #3a3c43;
}

.purchase-send,
.purchase-confirm {
  background: linear-gradient(135deg, #ff3c4b, #df071b);
  color: #fff;
}

.purchase-resend {
  width: 100%;
  margin-top: 8px;
}

.purchase-resend:disabled {
  color: #9a989c;
  cursor: not-allowed;
}

@media (max-width: 520px) {
  .purchase-modal { padding: 14px; }
  .purchase-dialog { padding: 28px 20px 22px; border-radius: 22px; }
  .purchase-step h2 { font-size: 23px; }
}

.roulette-page { height: 100vh; min-height: 100vh; overflow-x: hidden; overflow-y: auto; background: radial-gradient(circle at 50% 25%, #fff 0, #fff9fa 48%, #fff 100%); color: #10131b; }
.roulette-home { border: 0; background: none; cursor: pointer; }
.roulette-wrap { width: min(1320px, calc(100% - 50px)); margin: 0 auto; padding: 26px 0 70px; }
.roulette-back { border: 0; background: none; color: #242730; font-size: 25px; font-weight: 800; cursor: pointer; }
.roulette-title { display: grid; justify-items: center; margin: -5px 0 28px; text-align: center; }
.roulette-title img { width: 104px; height: 82px; object-fit: contain; }
.roulette-title h1 { margin: -2px 0 5px; font-size: 39px; }
.roulette-title p { margin: 0; color: #666871; font-size: 19px; }
.roulette-timer { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 7px 13px; border: 1px solid #eadfe2; border-radius: 12px; background: #fff; color: #73747b; font-size: 13px; }
.roulette-timer strong { min-width: 45px; color: #e3182c; font-size: 17px; font-variant-numeric: tabular-nums; }
.roulette-wheel { position: relative; height: 126px; margin: 0 auto 28px; overflow: hidden; border: 18px solid #f5f2f4; border-radius: 33px; box-shadow: inset 0 0 0 1px #e7e2e5, 0 10px 30px #6f39430e; }
.roulette-pointer { position: absolute; z-index: 4; left: 50%; top: -12px; width: 0; height: 0; transform: translateX(-50%); border-left: 19px solid transparent; border-right: 19px solid transparent; border-top: 31px solid #fff; filter: drop-shadow(0 4px 5px #30151b33); }
.roulette-track { display: flex; width: max-content; height: 90px; will-change: transform; }
.roulette-track span { display: grid; flex: 0 0 78px; place-items: center; height: 90px; color: #fff; font-size: 31px; font-weight: 800; box-shadow: inset -1px 0 #ffffff18; }
.roulette-track .red,.roulette-history .red { background: linear-gradient(145deg,#f14a55,#d5162a); }
.roulette-track .black,.roulette-history .black { background: linear-gradient(145deg,#3d3f43,#17191d); }
.roulette-track .green,.roulette-history .green { background: linear-gradient(145deg,#55b85a,#278732); }
.roulette-controls { display: grid; grid-template-columns: 1.3fr .8fr; align-items: end; gap: 28px; }
.roulette-controls label { display: grid; gap: 8px; font-size: 18px; font-weight: 800; }
.roulette-bet { display: grid; grid-template-columns: 42px 1fr repeat(3,70px); align-items: center; height: 62px; padding: 6px 9px; border: 2px solid #e4dfe2; border-radius: 17px; background: #fff; }
.roulette-bet img { width: 34px; height: 34px; object-fit: contain; }
.roulette-bet input { min-width: 0; border: 0; outline: 0; font-size: 24px; font-weight: 800; }
.roulette-bet button { height: 44px; margin-left: 6px; border: 0; border-radius: 11px; background: #f2eff1; font-size: 17px; font-weight: 800; cursor: pointer; }
.roulette-spin { height: 62px; border: 0; border-radius: 17px; background: linear-gradient(135deg,#ff4051,#dc071b); color: #fff; font-size: 20px; font-weight: 850; cursor: pointer; box-shadow: 0 10px 24px #df10252b; }
.roulette-spin:disabled { opacity: .6; cursor: not-allowed; }
.roulette-hint { min-height: 21px; margin: 7px 0 13px; color: #777981; font-size: 13px; }
.roulette-colors { display: grid; grid-template-columns: repeat(3,1fr); gap: 18px; }
.roulette-colors button { display: flex; justify-content: space-between; align-items: center; height: 68px; padding: 0 28px; border: 3px solid transparent; border-radius: 18px; color: #fff; font-size: 20px; font-weight: 850; cursor: pointer; transition: transform .16s,border-color .16s,box-shadow .16s; }
.roulette-colors button[data-color=red] { background: linear-gradient(145deg,#f04c57,#d91a2c); }
.roulette-colors button[data-color=black] { background: linear-gradient(145deg,#414348,#202226); }
.roulette-colors button[data-color=green] { background: linear-gradient(145deg,#55b65a,#2d8a35); }
.roulette-colors button.selected { transform: translateY(-3px); border-color:#fff; box-shadow:0 0 0 3px #ffb9c1,0 9px 20px #5b1b2523; }
.roulette-players { display: grid; grid-template-columns: repeat(3,1fr); gap: 18px; margin-top: 17px; }
.roulette-players section { overflow: hidden; border: 1px solid #e5e1e3; border-radius: 18px; background: #fff; box-shadow: 0 8px 25px #40212a0b; }
.roulette-players h2 { display:flex; align-items:center; justify-content:space-between; gap:10px; margin: 0; padding: 13px 17px; background: #faf7f8; font-size: 15px; }
.roulette-players .pool-total { color:#e21a2e; font-size:13px; font-variant-numeric:tabular-nums; }
.roulette-players article { display: flex; justify-content: space-between; align-items: center; min-height: 52px; padding: 8px 16px; border-top: 1px solid #f0edef; }
.roulette-players article.roulette-user { background:#fff5f6; box-shadow:inset 3px 0 #ed1d34; }
.roulette-players article.roulette-user b::after { content:' (Kamu)'; color:#e21a2e; font-size:11px; }
.roulette-players article b { font-size: 14px; }
.roulette-players article strong { color: #44474e; font-size: 14px; transition: color .25s,transform .25s; }
.roulette-players article strong.roulette-win { color: #20a443; transform: scale(1.08); }
.roulette-players article strong.roulette-lose { color: #e12536; transform: scale(1.08); }
.roulette-history { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 22px; padding: 18px 22px; border: 1px solid #e5e1e3; border-radius: 18px; background:#fff; }
.roulette-history h2 { margin: 0; font-size: 17px; white-space: nowrap; }
.roulette-history h2 i { display:inline-block; width:7px; height:7px; margin-right:7px; border-radius:50%; background:#2fbf55; }
.roulette-history>div { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:7px; }
.roulette-history span { display:grid; place-items:center; width:36px; height:36px; border-radius:9px; color:#fff; font-weight:800; }

@media (max-width: 760px) {
  .roulette-wrap { width: calc(100% - 28px); padding-top: 17px; }
  .roulette-title { margin: 2px 0 19px; }
  .roulette-title img { width: 83px; height: 65px; }
  .roulette-title h1 { font-size: 31px; }
  .roulette-title p { font-size: 15px; }
  .roulette-wheel { height: 105px; border-width: 13px; border-radius: 25px; }
  .roulette-track,.roulette-track span { height: 79px; }
  .roulette-controls { grid-template-columns: 1fr; gap: 12px; }
  .roulette-bet { grid-template-columns: 35px minmax(70px,1fr) repeat(3,52px); }
  .roulette-bet input { font-size: 19px; }
  .roulette-bet button { padding:0 5px; font-size:14px; }
  .roulette-colors { gap: 7px; }
  .roulette-colors button { height: 58px; padding: 0 10px; font-size: 15px; }
  .roulette-players { grid-template-columns: 1fr; gap: 10px; }
  .roulette-history { align-items:flex-start; flex-direction:column; }
  .roulette-history>div { justify-content:flex-start; }
}

.header-profile {
  display: grid;
  grid-template-columns: minmax(90px, 150px) 36px;
  align-items: center;
  gap: 6px;
  padding: 5px 6px 5px 12px;
  border: 1px solid #e9e3e5;
  border-radius: 14px;
  background: #fff9fa;
}

.header-profile input {
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: #24262e;
  font-size: 14px;
  font-weight: 800;
}

.header-profile input:not([readonly]) {
  color: #df1227;
}

.header-profile button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: #f0ecee;
  color: #45474e;
  font-size: 17px;
  font-weight: 900;
  cursor: pointer;
}

.header-profile .profile-save,
.header-profile .profile-cancel {
  display: none;
}

.header-profile.editing {
  grid-template-columns: minmax(90px, 150px) 34px 34px;
  border-color: #ffb9c1;
  box-shadow: 0 0 0 3px #ff233b12;
}

.header-profile.editing .profile-edit { display: none; }
.header-profile.editing .profile-save,
.header-profile.editing .profile-cancel { display: grid; }
.header-profile.editing .profile-save { background: #e51a2e; color: #fff; }

@media (max-width: 700px) {
  .home-header.has-profile {
    height: auto;
    min-height: 68px;
    flex-wrap: wrap;
    padding-top: 7px;
    padding-bottom: 7px;
  }
  .home-header.has-profile .home-logo { order: 1; }
  .home-header.has-profile .home-actions { order: 2; }
  .header-profile {
    order: 3;
    width: 100%;
    grid-template-columns: 1fr 36px;
  }
  .header-profile.editing { grid-template-columns: 1fr 34px 34px; }
}

.room-owner {
  display: inline-block;
  margin-left: 7px;
  padding: 3px 7px;
  border-radius: 7px;
  background: #f3eff1;
  color: #666871;
  font-size: 12px;
  font-weight: 750;
}

.history-row > span:first-child small {
  display: block;
  margin-top: 2px;
  color: #777981;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
}
