html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: url('Silk_Road/background_nighthp.jpg') no-repeat center center fixed;
  background-size: cover;
}

/* jika layar <= 768px (umumnya HP) */
@media only screen and (max-width: 768px) {
  body {
    background: url('Silk_Road/background_nighthp.jpg') no-repeat center center fixed;
    background-size: cover;
  }
}
/* efek lampu bergerak */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;

  mix-blend-mode: screen;
  will-change: transform;
  z-index: 1;
}

body.spin-active::before {
  animation: none;
}

/* lapisan bintang acak */
#star-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}
.star {
  position: absolute;
  width: 2px;
  height: 2px;
  background: white;
  border-radius: 50%;
  opacity: 0.5;
  animation: twinkle 2s infinite alternate;
}



/* SLOT AREA */
#slot-container {
  display:flex;
  justify-content:center;
  margin-top:5vh;
}


/* KHUSUS HP */
@media (max-width: 768px) {
  #slot-container {
    justify-content:center;
    margin-top: 10vh; /* 🔥 turunin dikit */
  }
}
/* SLOT WRAPPER */
#slot {
  display:flex;
  gap:1.5vw;
  padding:2vw;
  background: linear-gradient(145deg, #1a0033, #000);
  border-radius:25px;
  border: 4px solid gold;
  box-shadow:
    0 0 10px gold,
    inset 0 0 15px rgba(255,215,0,0.2);
  position: relative;
}

/* lampu pinggir */
#slot::before {
  content:"";
  position:absolute;
  inset:-6px;
  border-radius:30px;
  background: linear-gradient(90deg, red, yellow, lime, cyan, magenta, red);
  background-size:400%;
  animation: borderRun 6s linear infinite;
  z-index:-1;
  filter: blur(8px);
}

@keyframes borderRun {
  0% { background-position:0% }
  100% { background-position:400% }
}

/* REEL RESPONSIVE */
.reel {
  width:12vw;
  max-width:90px;
  height:56vw;
  max-height:360px;
  overflow:hidden;
  border-radius:15px;
  background: linear-gradient(180deg,#111,#222);
  padding:0.5vw;
  box-shadow:
    inset 0 0 15px rgba(0,0,0,0.9),
    inset 0 0 30px rgba(255,255,255,0.05),
    0 0 15px rgba(0,0,0,0.8);
  position: relative;
    will-change: transform;
  contain: layout paint size;
}

/* efek kaca */
.reel::after {
  content:"";
  position:absolute;
  top:0;
  left:0;
  width:100%;
  height:100%;
  background: linear-gradient(
    120deg,
    rgba(255,255,255,0.15),
    transparent 40%
  );
  pointer-events:none;
}
.reel-inner {
  will-change: transform;
  transform: translateZ(0);
}
/* CELL */
.cell {
  width:100%;
  aspect-ratio:1/1;
  display:flex;
  align-items:center;
  justify-content:center;
  contain: content;
}

/* SYMBOL */
.symbol {
  width:90%;
  height:90%;
  object-fit:contain;
}

/* BIG WIN */
/* BASE */
#bigWin {
  position: fixed;
  top: 30%;
  width: 100%;
  text-align: center;
  display: none;
  z-index: 9999;
}

/* TITLE */
#bigWinTitle {
  font-size: 6vw;
  font-weight: bold;
  animation: pop 0.6s ease infinite alternate;
}

/* AMOUNT */
#bigAmount {
  font-size: 5vw;
  margin-top: 10px;
}

/* LEVEL WARNA */
.big { color: #00ffcc; text-shadow: 0 0 20px cyan; }
.mega { color: gold; text-shadow: 0 0 30px orange; }
.sensational { color: #ff00ff; text-shadow: 0 0 40px magenta; }
.super { 
  color: #ff0000; 
  text-shadow: 0 0 50px red, 0 0 100px gold; 
}

/* ANIMASI */
@keyframes pop {
  from { transform: scale(1); }
  to { transform: scale(1.2); }
}
/* BIG WIN */
#bigWinTitle {
  margin-top:20vh;
  font-size:8vw;
}

#bigWinAmount {
  font-size:6vw;
}
/* 🎬 SCREEN OVERLAY */
#megaWinScreen {
  position: fixed;
  top:0;
  left:0;
  width:100%;
  height:100%;
  display:none;
  justify-content:center;
  align-items:center;
  flex-direction:column;
  background: radial-gradient(circle, rgba(0,0,0,0.6), rgba(0,0,0,0.95));
  z-index: 99999;
}

/* TEXT MEGA / SUPER */
.mega-text {
  font-size: 8vw;
  font-weight: bold;
  color: gold;
  text-shadow:
    0 0 20px gold,
    0 0 40px orange,
    0 0 80px red;
  animation: megaPop 0.8s ease infinite alternate;
}

/* NOMINAL */
.mega-amount {
  font-size: 6vw;
  color: #00ffcc;
  margin-top: 20px;
  text-shadow: 0 0 20px cyan;
}

/* ANIMASI TEXT */
@keyframes megaPop {
  from { transform: scale(1); }
  to { transform: scale(1.2); }
}

/* FLASH */
.flashMega {
  position:absolute;
  width:100%;
  height:100%;
  background:white;
  opacity:0;
  animation: flashMegaAnim 400ms ease;
}

@keyframes flashMegaAnim {
  0% { opacity: 0.9; }
  100% { opacity: 0; }
}

/* SHAKE SCREEN */
.shake {
  animation: shake 0.4s;
}
/* 💥 WIN PECAH */
.cell.win {
    position: relative;
  animation: winGlow 0.6s ease 2;
box-shadow: 0 0 10px gold;
  animation: explodeCell 0.5s ease forwards;
  position: relative;
  z-index: 2;
}

@keyframes explodeCell {
  0% { transform: scale(1) rotate(0deg); filter: brightness(1); }
  40% { transform: scale(1.5) rotate(10deg); filter: brightness(2); }
  70% { transform: scale(0.9) rotate(-8deg); }
  100% { transform: scale(1); filter: brightness(1); }
}


/* 💫 SHOCKWAVE */
.wave {
  position: absolute;
  border: 2px solid gold;
  border-radius: 50%;
  pointer-events: none;
  animation: waveAnim 600ms ease-out forwards;
}

@keyframes waveAnim {
  from {
    width: 10px;
    height: 10px;
    opacity: 1;
  }
  to {
    width: 120px;
    height: 120px;
    opacity: 0;
  }
}


@keyframes boom {
  0% { transform: scale(1) rotate(0deg); opacity:1; }
  40% { transform: scale(1.8) rotate(15deg); }
  70% { transform: scale(0.8) rotate(-10deg); }
  100% { transform: scale(0) rotate(25deg); opacity:0; }
}
/* 🎬 CINEMATIC SCREEN EFFECT */
#cinematic {
  position: fixed;
  top:0;
  left:0;
  width:100%;
  height:100%;
  pointer-events:none;
  z-index:9998;
}

.flash {
  position:absolute;
  width:100%;
  height:100%;
  background:white;
  opacity:0;
  animation: flashAnim 300ms ease;
}

@keyframes flashAnim {
  0% { opacity: 0.8; }
  100% { opacity: 0; }
}



@keyframes winGlow {
  from { filter: brightness(1) drop-shadow(0 0 5px gold); }
  to { filter: brightness(2) drop-shadow(0 0 20px orange); }
} 
@keyframes shake {
  0% { transform: translate(0,0); }
  25% { transform: translate(3px,-3px); }
  50% { transform: translate(-3px,3px); }
  75% { transform: translate(2px,-2px); }
  100% { transform: translate(0,0); }
  
}
#game {
  width: 100%;
  height: 100%;
}
#giftFx {
  position: fixed;
  top:0;
  left:0;
  width:100%;
  height:100%;
  pointer-events:none;
  z-index:9999;
}

.gift-box {
  position:absolute;
  width:120px;
  height:120px;
  left:50%;
  top:50%;
  transform:translate(-50%,-50%);
  animation: giftBoom 700ms ease forwards;
}

@keyframes giftBoom {
  0% { transform:translate(-50%,-50%) scale(0.5); opacity:0; }
  50% { transform:translate(-50%,-50%) scale(1.2); }
  100% { transform:translate(-50%,-50%) scale(0); opacity:0; }
}

.gift-text {
  position:absolute;
  top:40%;
  width:100%;
  text-align:center;
  font-size:40px;
  font-weight:bold;
  color:gold;
  animation: fadeUp 1s ease forwards;
}

@keyframes fadeUp {
  0% { opacity:0; transform:translateY(30px); }
  100% { opacity:1; transform:translateY(0); }
}

@keyframes lightRun {
  0% { background-position:0; }
  100% { background-position:300px; }
}

/* MODE BAR */
#mode {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
}

/* DEFAULT = PC (desktop) */
/* DEFAULT = PC (desktop) */
/* ========================= */
/* DESKTOP */
/* ========================= */
#logo {
  position: fixed; /* 🔥 kunci: tidak ikut layout */
  top: 50%;
  left: 0%; /* posisi di kiri layar */
  transform: translateY(-50%);
  z-index: 10;
}

#logo img {
  width: 360px;   /* 2x */
  height: 126px;
  display: block;
}


/* ========================= */
/* 📱 HP */
/* ========================= */
@media (max-width: 768px) {

  #logo {
    position: absolute; /* kembali normal di HP */
    top: 2%; /* sudah kamu bilang ini oke */
    left: 50%;
    transform: translateX(-50%);
  }

  #logo img {
    width: 210px;
    height: 63px;
  }

}
/* ✨ IDLE GLOW */
#logo img {
  animation: logoGlow 2s ease-in-out infinite alternate;
}

@keyframes logoGlow {
  from {
    filter: drop-shadow(0 0 5px gold);
  }
  to {
    filter: drop-shadow(0 0 20px orange);
  }
}
/* 🎰 SAAT SPIN */
#logo.spin img {
  animation: logoSpin 0.3s infinite;
}

@keyframes logoSpin {
  0% { transform: translateX(0); filter: brightness(1); }
  25% { transform: translateX(-2px); filter: brightness(1.3); }
  50% { transform: translateX(2px); filter: brightness(1.5); }
  75% { transform: translateX(-1px); }
  100% { transform: translateX(0); }
}
/* 💥 WIN EFFECT */
#logo.win img {
  animation: logoWin 0.6s ease;
}

@keyframes logoWin {
  0%   { transform: scale(1); filter: brightness(1); }
  50%  { transform: scale(1.3); filter: brightness(2) drop-shadow(0 0 30px gold); }
  100% { transform: scale(1); }
}
@media (max-width: 768px) {
  body::before {
    display: none;
  }

  #slot::before {
    display: none;
  }

  .star {
    display: none;
  }
}

/* FIX: biar slot lama tidak bentrok */
#slot {
  display: flex;
  justify-content: center;
  align-items: center;
}

/* reel override biar cocok dengan JS kamu */
.reel {
  height: 480px !important;
}

/* strip tetap dari sistem kamu */
.strip {
  position: absolute;
  width: 100%;
}

/* item (pengganti .cell) */
.item {
  height: 120px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 32px;
}

/* UI tambahan */
.balance {
  text-align: center;
  margin-top: 15px;
  font-size: 18px;
  color: gold;
}

.control-bottom {
  margin-top: 15px;
  display: flex;
  justify-content: center;
  gap: 20px;
}

.spin-btn {
  padding: 16px 50px;
  font-size: 18px;
  border-radius: 50px;
}

.bet-btn {
  padding: 10px 16px;
}

/* 🎰 FRAME SLOT (lebih mewah) */
#slot {
  background: radial-gradient(circle at top, #2a004f, #000);
  border: 4px solid gold;
  border-radius: 25px;
  padding: 15px;
  box-shadow:
    0 0 20px gold,
    inset 0 0 30px rgba(255,215,0,0.3);
}

/* ✨ lampu bergerak */
#slot::before {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: 30px;
  background: linear-gradient(90deg, gold, orange, yellow, gold);
  background-size: 300%;
  animation: borderRun 4s linear infinite;
  filter: blur(10px);
  z-index: -1;
}

@keyframes borderRun {
  0% { background-position: 0% }
  100% { background-position: 300% }
}

/* 🎰 REEL */
.reel {
  background: linear-gradient(180deg,#111,#000);
  border: 2px solid #222;
}

/* ✨ SYMBOL GLOW */
.item {
  filter: drop-shadow(0 0 5px rgba(255,255,255,0.3));
}



/* 🎯 SPIN BUTTON (PRAGMATIC STYLE) */
.spin-btn {
  background: radial-gradient(circle, #ffcc00, #ff8800);
  color: black;
  font-weight: bold;
  border: 2px solid gold;
  box-shadow:
    0 0 15px gold,
    inset 0 0 10px rgba(255,255,255,0.5);
}

/* hover */
.spin-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 0 25px gold;
}
/* efek pecah simbol menang */


@keyframes winGlow {
  0% { filter: brightness(1) drop-shadow(0 0 5px gold); }
  50% { filter: brightness(2) drop-shadow(0 0 20px orange); }
  100% { filter: brightness(1) drop-shadow(0 0 5px gold); }
}

/* particle pecah */
.particle {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff, gold);
  pointer-events: none;
  animation: explode 800ms ease-out forwards;
}

@keyframes explode {
  0% {
    transform: translate(0,0) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(var(--x), var(--y)) scale(0.3);
    opacity: 0;
  }
}

#fx-layer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1000;
  overflow: visible;
}


@keyframes explode {
  to {
    transform: translate(var(--x), var(--y)) scale(0);
    opacity: 0;
  }
}

.item.win {
  box-shadow: 0 0 20px gold;
  animation: pulse 0.8s ease-out;
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}
  button.active {
  background-color: green;   /* warna tombol aktif */
  color: white;              /* warna teks */
}
.side button.active {
  color: rgb(255, 255, 255); /* teks biru */
  border-color: #00f;
  box-shadow: 0 0 10px #00f, 0 0 20px rgba(0,0,255,0.3);
}

  #historyList {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    /* 2 kolom */
    grid-template-rows: repeat(3, auto);
    /* 3 baris */
    gap: 8px;
    list-style: none;
    padding: 0;
    margin: 0;
  }

  #historyList li {
    background: #222;
    color: #fff;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 14px;
    text-align: center;
  }

  /* INFO BAR */
  #info-bar {
    position: fixed;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%);
    width: 70%;
    max-width: 700px;

    display: grid;
    gap: 10px;
    padding: 8px;
    border-radius: 16px;

    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow:
      0 0 20px rgba(0, 255, 255, 0.2),
      0 0 40px rgba(255, 0, 200, 0.15),
      inset 0 0 20px rgba(255, 255, 255, 0.05);
    z-index: 1000;

    /* Default desktop: 1 baris (semua item sejajar) */
    grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
    grid-template-rows: auto;
    text-align: center;

    transition: all 0.4s ease;
    /* transisi halus saat layout berubah */
  }

  /* Mobile: 2 kolom × 3 baris */
  @media (max-width: 768px) {
    #info-bar {
      grid-template-columns: repeat(2, 1fr);
      grid-template-rows: repeat(3, auto);
    }
  }

  /* ITEM INFO BAR */
  #info-bar span {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6px 8px;
    border-radius: 12px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.05), rgba(0, 0, 0, 0.4));
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 12px;
    color: #fff;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.15), inset 0 0 10px rgba(255, 255, 255, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
  }

  #info-bar span span {
    font-weight: bold;
    margin-top: 4px;
    color: #00ffcc;
    text-shadow: 0 0 6px #00ffcc, 0 0 12px rgba(0, 255, 200, 0.7);
  }

  #info-bar span:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 0 12px #00ffff, 0 0 22px rgba(0, 255, 255, 0.4), 0 0 35px rgba(255, 0, 200, 0.3);
  }

  /* MEDIA QUERY UNTUK HP */
  @media (max-width: 500px) {
    #info-bar {
      grid-template-columns: repeat(2, 1fr);
      /* 2 kolom */
      grid-template-rows: repeat(3, auto);
      /* 3 baris */
    }
  }

  /* CONTROLS */
  #controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    width: 100%;
    position: fixed;
    bottom: 5vh;
    left: 50%;
    transform: translateX(-50%);
  }

  /* SIDE BUTTONS */
  .side {
    display: flex;
    flex-direction: row;
    gap: 12px;
    align-items: center;
  }

  /* SPIN BUTTON */
  #spinBtn {
    width: 18vw;
    height: 18vw;
    max-width: 130px;
    max-height: 130px;
    font-size: 4vw;
    font-weight: bold;
    color: #fff;
    border-radius: 50%;
    border: 3px solid gold;
    background: radial-gradient(circle, #ffcc00, #ff0000);
    box-shadow:
      0 0 20px gold,
      0 0 40px red,
      inset 0 0 15px rgba(255, 255, 255, 0.5);
    cursor: pointer;
    animation: pulse 1s infinite;
    position: relative;
  }

  #spinBtn::after {
    content: "";
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    background: conic-gradient(red, yellow, lime, cyan, magenta, red);
    filter: blur(10px);
    animation: spinGlow 3s linear infinite;
    z-index: -1;
  }

  @keyframes spinGlow {
    100% {
      transform: rotate(360deg);
    }
  }

  @keyframes pulse {
    0% {
      transform: scale(1);
    }

    50% {
      transform: scale(1.08);
    }

    100% {
      transform: scale(1);
    }
  }

  .side button {
    width: 8vw;
    height: 8vw;
    max-width: 70px;
    max-height: 70px;
    font-size: 1.2vw;
    font-weight: bold;
    color: #fff;
    background: linear-gradient(145deg, #444, #111);
    border: 2px solid #ff00cc;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px #ff00cc, 0 0 20px rgba(255, 0, 204, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
  }

  .side button:hover {
    transform: scale(1.1);
    box-shadow: 0 0 20px #ff00cc, 0 0 35px rgba(255, 0, 204, 0.5);
  }
#result {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  font-weight: bold;
  color: #00ffcc;
  font-size: clamp(18px, 4vw, 40px);
  z-index: 2000;
  text-shadow: 0 0 10px #00ffcc, 0 0 20px #00ffff;
}

@keyframes glowPulse {
  from {
    text-shadow:
      0 0 5px #00ffcc,
      0 0 10px #00ffff;
  }
  to {
    text-shadow:
      0 0 20px #00ffcc,
      0 0 40px #00ffff,
      0 0 60px #00ffff;
  }
}
/* efek kedap-kedip */
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.blink {
  animation: blink 0.3s infinite;
}

.impact {
  animation: shakeImpact 0.2s;
}

@keyframes shakeImpact {
  0% { transform: translateY(0); }
  50% { transform: translateY(4px); }
  100% { transform: translateY(0); }
}
.last-reel-hit {
  filter: brightness(1.5);
  transform: scale(1.05);
}