/* spin/assets/style5.css */
:root{
  --card: rgba(255,255,255,.88);
  --card2: rgba(255,255,255,.78);
  --text: #0f172a;
  --muted: #64748b;
  --primary: #e11d48;
  --primary2:#b91c1c;
  --outline: rgba(226,232,240,.9);
  --shadow: 0 18px 60px rgba(2,6,23,.16);
  --radius: 18px;

  --bg-image: url("../assets/bg.png");
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  color:var(--text);
  overflow-x:hidden;
  background:#ffeaa7;
}

.spin-bg{
  min-height:100vh;
  background:
    radial-gradient(circle at 30% 20%, rgba(255,255,255,.25) 0%, rgba(255,255,255,0) 50%),
    linear-gradient(180deg, rgba(255,210,92,.35) 0%, rgba(255,195,72,.25) 45%, rgba(255,255,255,.35) 100%),
    var(--bg-image);
  background-size: cover;
  background-position:center;
  padding: 14px 18px 22px;
}

/* ===== TOP STRIP ===== */
.top-strip{
  height: 46px;
  border-radius: 10px;
  background: rgba(255,255,255,.92);
  box-shadow: 0 10px 30px rgba(2,6,23,.12);
  display:flex;
  align-items:center;
  padding: 0 12px;
  gap:10px;
  position: sticky;
  top: 10px;
  z-index: 10;
}
.sound-btn{
  width:34px;height:34px;
  border-radius:10px;
  border:1px solid var(--outline);
  background:#fff;
  display:grid;
  place-items:center;
  cursor:pointer;
  user-select:none;
}
.sound-btn:active{transform:scale(.98)}
.top-strip .spacer{flex:1}
.top-strip a{
  margin-left:10px;
  font-weight:800;
  color:#0f172a;
  text-decoration:none;
  padding:8px 10px;
  border-radius:10px;
  border:1px solid var(--outline);
  background:#fff;
}
.top-strip a:hover{background:#f8fafc}

/* ===== WHEEL ===== */
.stage{
  display:grid;
  place-items:center;
  padding: 26px 0 18px;

  /* ✅ cho chắc không bị cắt bởi container */
  overflow: visible;
}
.wheel-wrap{
  width: min(520px, 92vw);
  aspect-ratio: 1/1;
  display:grid;
  place-items:center;
  position:relative;
  filter: drop-shadow(0 22px 40px rgba(2,6,23,.18));

  /* ✅ cho chắc không bị cắt bởi wrap */
  overflow: visible;
}
.wheel-img{
  width:100%;
  height:100%;
  object-fit:contain;
  display:block;

  /* ✅ QUAN TRỌNG: bỏ bo tròn vì nó cắt mép ảnh */
  border-radius: 0 !important;

  /* ✅ bỏ viền trắng / outline */
  border: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;

  transform: rotate(0deg);
}

.pointer-img{
  position:absolute;
  left:50%;
  transform: translateX(-50%);
  width: 105px;
  height:auto;
  z-index: 5;
  pointer-events:none;
  user-select:none;
}
.wheel-center{ display:none !important; }

/* ===== MAIN BAR (3 columns) ===== */
.bottom-bar{
  width: min(1120px, 96vw);
  margin: 8px auto 0;
  background: var(--card);
  border: 1px solid rgba(226,232,240,.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  display:grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 12px;
  align-items:center;
}

.code-input{
  height: 52px;
  border-radius: 12px;
  border: 1px solid rgba(226,232,240,.95);
  padding: 0 14px;
  outline: none;
  font-size: 15px;
  background: rgba(255,255,255,.95);
}
.code-input:focus{
  border-color: rgb(29 207 225 / 35%);
  box-shadow: 0 0 0 6px rgb(29 225 198 / 12%);
}

.balance{
  height:52px;
  border-radius:12px;
  border:1px solid rgba(226,232,240,.95);
  background: rgba(248,250,252,.9);
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:900;
  color:#00BFFF;
  letter-spacing:.2px;
}

.btn{
  height:52px;
  border-radius:12px;
  font-weight:900;
  cursor:pointer;
  border: 2px solid var(--primary);
  background:#fff;
  color: var(--primary);
  transition:.12s;
}
.btn:hover{transform: translateY(-1px)}
.btn:active{transform: translateY(0px)}
.btn:disabled{opacity:.6; cursor:not-allowed; transform:none}

.btn.primary{
  background: linear-gradient(135deg, #00BFFF 0%, #00BFFF 100%);
  color:#fff;
  border-color: transparent;
}

/* ✅ form nằm trong grid 3 cột mà không phá layout */
.inline-form{ display: contents; }

/* ===== TOAST ===== */
.toast{
  width: min(1120px, 96vw);
  margin: 12px auto 0;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(226,232,240,.95);
  background: var(--card2);
  box-shadow: 0 10px 24px rgba(2,6,23,.10);
  font-weight:800;
}
.toast.error{
  border-color: rgba(239,68,68,.28);
  background: rgba(239,68,68,.10);
  color:#991b1b;
}
.toast.success{
  border-color: rgba(34,197,94,.25);
  background: rgba(34,197,94,.10);
  color:#166534;
}

.login-err{
  width:min(1120px,96vw);
  margin:8px auto 0;
  text-align:center;
  color:#b91c1c;
  font-weight:900;
  font-size:13px;
}

/* ===== HISTORY ===== */
.history{
  width: min(1120px, 96vw);
  margin: 14px auto 0;
  background: var(--card);
  border: 1px solid rgba(226,232,240,.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow:hidden;
}
.history-head{
  padding: 14px 16px;
  font-weight: 900;
  display:flex;
  align-items:center;
  justify-content:space-between;
  border-bottom: 1px solid rgba(226,232,240,.9);
}
.history-sub{
  font-size: 13px;
  color: var(--muted);
  font-weight:700;
}
.table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
}
.table th, .table td{
  padding: 12px 14px;
  border-bottom: 1px solid rgba(226,232,240,.9);
  font-size: 14px;
  white-space:nowrap;
}
.table th{
  text-align:left;
  font-weight:900;
  background: rgba(248,250,252,.8);
}

/* ===== WINNER TICKER (SMOOTH) ===== */
.winner-ticker{
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 9999;
  width: min(680px, 92vw);
  background: rgba(255,255,255,.92);
  border: 1px solid rgba(226,232,240,.95);
  border-radius: 16px;
  box-shadow: 0 18px 50px rgba(2,6,23,.20);
  padding: 10px 12px;
  backdrop-filter: blur(8px);

  opacity: 0;
  transform: translateX(-50%) translateY(14px);
  pointer-events: none;
}
.winner-ticker-title{
  font-weight: 900;
  font-size: 12px;
  opacity: .75;
  margin-bottom: 4px;
}
.winner-ticker-body{
  font-weight: 900;
  font-size: 14px;
  line-height: 1.35;
}
.winner-ticker-body b{ color: #09b0e2; }
.winner-ticker.show{
  animation: winnerPop 3.5s ease-in-out both;
}
@keyframes winnerPop{
  0%   { opacity:0; transform: translateX(-50%) translateY(14px); }
  12%  { opacity:1; transform: translateX(-50%) translateY(0px); }
  78%  { opacity:1; transform: translateX(-50%) translateY(0px); }
  100% { opacity:0; transform: translateX(-50%) translateY(-12px); }
}

/* ===== RULE BAR (same card as bottom-bar, 1 button) ===== */
.rule-bar{
  width: min(1120px, 96vw);
  margin: 10px auto 0;
  background: var(--card);
  border: 1px solid rgba(226,232,240,.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  display:grid;
  grid-template-columns: 1fr;
  align-items:center;
}
.rule-btn{
  width: 100%;
  height: 52px;
  border-radius: 12px;
}

/* ===== MODAL ===== */
.modal{ position:fixed; inset:0; z-index:10000; }
.modal-backdrop{
  position:absolute; inset:0;
  background: rgba(0,0,0,.35);
  backdrop-filter: blur(4px);
}
.modal-card{
  position:absolute;
  left:50%; top:50%;
  transform: translate(-50%,-50%);
  width: min(620px, 92vw);
  background: rgba(255,255,255,.96);
  border: 1px solid rgba(226,232,240,.95);
  border-radius: 18px;
  box-shadow: 0 22px 70px rgba(2,6,23,.25);
  overflow:hidden;
}
.modal-head{
  display:flex; align-items:center; justify-content:space-between;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(226,232,240,.9);
}
.modal-title{ font-weight: 900; }
.modal-close{
  width:36px; height:36px;
  border-radius: 12px;
  border: 1px solid rgba(226,232,240,.95);
  background:#fff;
  cursor:pointer;
  font-weight:900;
}
.modal-body{ padding: 14px 16px; }
.rule-list{ margin:0; padding-left:18px; }
.rule-list li{ margin: 8px 0; font-weight:700; }
.modal-note{ margin-top: 10px; font-size: 12px; opacity:.7; }
.modal-foot{
  padding: 12px 14px;
  border-top: 1px solid rgba(226,232,240,.9);
  display:flex; justify-content:flex-end;
}

/* ===== Result popup content ===== */
#resultBody{
  font-weight:800;
  line-height:1.5;
  font-size:15px;
}
#resultBody b{ color:#e11d48; }

/* =========================================================
   ✅ MOBILE ONLY: căn giữa & không bị dồn phải
   (PC không bị ảnh hưởng)
   ========================================================= */
@media (max-width: 768px){

  /* giữ padding mobile gọn */
  .spin-bg{
    padding: 12px 12px 18px;
  }

  /* Các khối chính trên mobile: giới hạn max-width & center */
  .stage,
  .bottom-bar,
  .rule-bar,
  .history{
    width: min(520px, calc(100% - 16px));
    margin-left: auto !important;
    margin-right: auto !important;
  }

  /* bottom-bar: chuyển sang flex để không bị lệch */
  .bottom-bar{
    display:flex;
    gap:10px;
    align-items:center;
    padding: 14px;
  }

  .bottom-bar .code-input{
    flex: 1;
    min-width: 0;
  }

  /* Wheel luôn giữa */
  .stage{
    display:flex;
    justify-content:center;
    align-items:center;
    padding: 18px 0 14px;
  }

  .wheel-wrap{
    width: min(520px, 92vw);
    margin-left: auto !important;
    margin-right: auto !important;
  }

  /* Ticker vốn fixed center rồi, không ép max-width kiểu 520 nữa */
  .winner-ticker{
    width: min(680px, 92vw);
  }
}

