* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: linear-gradient(180deg, #f1f5f9 0%, #f8fafc 100%);
  color: #0f172a;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 12px 40px;
}
body.rtl {
  font-family: 'Cairo', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  direction: rtl;
}
.container { width: 100%; max-width: 480px; margin: 0 auto; }
.main-card {
  background: #ffffff;
  border-radius: 28px;
  padding: 24px 18px 28px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.05);
  position: relative;
  overflow: hidden;
}
.main-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; height: 5px;
  background: linear-gradient(90deg, #f59e0b, #fbbf24, #d97706);
}
.brand-header {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 22px;
}
.brand-logo-img { height: 44px; }
.hero-title {
  font-size: 30px;
  font-weight: 800;
  color: #000000;
  margin-bottom: 8px;
  line-height: 1.2;
}
.hero-subtitle {
  font-size: 14px;
  color: #475569;
  line-height: 1.5;
  margin-bottom: 6px;
}
.hero-subtitle strong { color: #0f172a; font-weight: 700; }
.hero-instructions { font-size: 13px; color: #64748b; margin-bottom: 18px; }
.chances-strip {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 12px;
  padding: 8px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
  color: #92400e;
  margin-bottom: 18px;
}
.keys-dots { display: flex; gap: 4px; }
.key-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #f59e0b;
  transition: background 0.3s;
}
.key-dot.used { background: #cbd5e1; }
.chests-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}
.chest-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  padding: 12px 6px 14px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  transition: transform 0.2s, box-shadow 0.2s;
}
.chest-card:hover { box-shadow: 0 6px 14px rgba(0, 0, 0, 0.08); }
.chest-svg-wrap {
  width: 100%; max-width: 130px; height: 95px;
  position: relative; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.chest-svg { width: 100%; height: 100%; transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); }
.chest-card.shaking .chest-svg { animation: chestWobble 0.7s ease-in-out; }
@keyframes chestWobble {
  0%, 100% { transform: rotate(0deg) scale(1); }
  20% { transform: rotate(-5deg) scale(1.05); }
  40% { transform: rotate(5deg) scale(1.05); }
  60% { transform: rotate(-4deg) scale(1.03); }
  80% { transform: rotate(3deg) scale(1.02); }
}
.padlock-el { transition: all 0.3s ease; }
.chest-card.opened .padlock-el { opacity: 0; transform: translateY(12px) scale(0.6); }
.lid-el {
  transform-origin: 110px 88px;
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.chest-card.opened .lid-el { transform: rotate(-38deg) translateY(-22px); }
.gold-inside { opacity: 0; transition: opacity 0.4s ease 0.2s; }
.chest-card.opened.winner .gold-inside { opacity: 1; }
.empty-inside { opacity: 0; transition: opacity 0.4s ease 0.2s; }
.chest-card.opened.empty .empty-inside { opacity: 0.8; }
.buka-btn {
  width: 100%;
  margin-top: 10px;
  background: #ffaa00;
  color: #000000;
  border: none;
  border-radius: 14px;
  padding: 10px 4px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.5px;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(255, 170, 0, 0.3);
  transition: all 0.2s;
  text-transform: uppercase;
}
.buka-btn:hover:not(:disabled) { background: #f59e0b; transform: translateY(-1px); }
.buka-btn:disabled { background: #cbd5e1; color: #ffffff; cursor: not-allowed; box-shadow: none; }
.chest-card.winner .buka-btn { background: #10b981; color: #ffffff; }
.try-again-alert {
  display: none;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 12px;
  color: #92400e;
  margin-bottom: 16px;
  text-align: center;
}
.try-again-alert.active { display: block; animation: fadeIn 0.3s; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}
.winners-feed {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 12px 14px;
  margin-top: 16px;
}
.feed-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  color: #475569;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid #e2e8f0;
}
.live-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #10b981;
  margin-inline-end: 4px;
}
.feed-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  color: #1e293b;
}
.feed-prize { color: #d97706; font-weight: 700; }
.trust-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 14px;
  text-align: center;
  font-size: 11px;
  color: #475569;
}
.trust-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 10px 6px;
}
.trust-card strong { display: block; color: #0f172a; font-size: 12px; }
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-overlay.active { display: flex; animation: modalFadeIn 0.3s ease-out; }
@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}
.modal-box {
  background: #ffffff;
  width: 100%; max-width: 420px;
  border-radius: 26px;
  padding: 26px 20px;
  text-align: center;
  position: relative;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
}
.modal-icon-badge {
  width: 72px; height: 72px;
  background: linear-gradient(135deg, #fef08a, #f59e0b);
  border-radius: 50%;
  margin: 0 auto 14px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.35);
}
.modal-icon-badge img { width: 38px; height: 38px; }
.modal-title { font-size: 24px; font-weight: 800; color: #0f172a; margin-bottom: 6px; }
.modal-desc { font-size: 13px; color: #64748b; margin-bottom: 16px; }
.prize-box {
  background: linear-gradient(135deg, #fffbeb, #fef3c7);
  border: 1px solid #fde68a;
  border-radius: 18px;
  padding: 16px;
  margin-bottom: 16px;
}
.prize-badge { font-size: 11px; font-weight: 800; text-transform: uppercase; color: #b45309; }
.prize-val { font-size: 32px; font-weight: 900; color: #78350f; margin: 4px 0; }
.timer-alert {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 12px;
  padding: 10px;
  font-size: 12px;
  font-weight: 700;
  color: #dc2626;
  margin-bottom: 18px;
}
.claim-btn {
  display: block; width: 100%;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #000000;
  text-decoration: none;
  padding: 15px 20px;
  border-radius: 16px;
  font-size: 16px; font-weight: 800; text-align: center;
  box-shadow: 0 4px 14px rgba(217, 119, 6, 0.4);
  cursor: pointer;
  transition: all 0.2s;
}
.claim-btn:hover {
  background: linear-gradient(135deg, #d97706, #b45309);
  color: #ffffff;
  transform: translateY(-2px);
}
#confetti-canvas { position: fixed; inset: 0; pointer-events: none; z-index: 1001; }
