* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', Tahoma, Arial, sans-serif; }
html, body { min-height: 100%; }
body {
  min-height: 100vh;
  background: radial-gradient(circle at top, #2a2a45, #16161f 70%);
  color: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 12px;
  direction: rtl;
}

.hidden { display: none !important; }

/* ============ AUTH ============ */
.auth-screen {
  width: 100%;
  max-width: 420px;
  background: linear-gradient(160deg, #2b2b3f, #22222f);
  border-radius: 22px;
  padding: 24px 22px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,255,255,0.05);
  border: 1px solid rgba(125,211,252,0.08);
  animation: popIn 0.35s ease;
}
.auth-screen h1 { text-align: center; font-size: 22px; margin-bottom: 6px; color: #7dd3fc; letter-spacing: 0.5px; }
.auth-screen .subtitle { text-align: center; font-size: 12px; color: #9ca3af; margin-bottom: 20px; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: #1a1a26; padding: 5px; border-radius: 14px; margin-bottom: 18px; }
.tabs button { padding: 10px; font-size: 13.5px; border-radius: 10px; background: transparent; color: #9ca3af; border: none; cursor: pointer; transition: 0.25s; font-weight: 600; width: 100%; }
.tabs button.active { background: linear-gradient(135deg, #7dd3fc, #38bdf8); color: #0c1e2e; box-shadow: 0 4px 14px rgba(125,211,252,0.35); }
.auth-form .form-group { margin-bottom: 12px; }
.auth-form label { display: block; font-size: 12.5px; color: #9ca3af; margin-bottom: 6px; font-weight: 500; }
.auth-form input { width: 100%; padding: 11px 13px; font-size: 13.5px; border-radius: 11px; border: 2px solid #383850; background: #1a1a26; color: #fff; outline: none; transition: 0.25s; }
.auth-form input:focus { border-color: #7dd3fc; box-shadow: 0 0 0 4px rgba(125,211,252,0.12); }
.auth-form button[type="submit"] { width: 100%; padding: 13px; font-size: 15px; font-weight: 700; border: none; border-radius: 13px; cursor: pointer; background: linear-gradient(135deg, #7dd3fc, #38bdf8); color: #0c1e2e; margin-top: 8px; transition: 0.25s; box-shadow: 0 6px 20px rgba(125,211,252,0.25); }
.auth-form button[type="submit"]:hover { background: linear-gradient(135deg, #38bdf8, #0ea5e9); transform: translateY(-2px); }
.auth-message { text-align: center; margin-top: 12px; font-size: 13px; min-height: 18px; font-weight: 600; }

/* ============ GAME ============ */
.container { width: 100%; max-width: 460px; background: linear-gradient(160deg, #2b2b3f, #22222f); border-radius: 22px; padding: 18px 20px; box-shadow: 0 20px 60px rgba(0,0,0,0.55); border: 1px solid rgba(125,211,252,0.08); position: relative; }
.top-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.menu-btn { width: 40px; height: 40px; padding: 0; border-radius: 12px; background: #1a1a26; border: 2px solid #383850; color: #7dd3fc; font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.menu-btn:hover { background: #7dd3fc; color: #0c1e2e; border-color: #7dd3fc; }
.user-badge { display: flex; align-items: center; gap: 7px; background: linear-gradient(135deg, #1e1e2e, #2a2a40); border: 1px solid #383850; border-radius: 50px; padding: 5px 5px 5px 13px; font-size: 12.5px; color: #d1d5db; }
.user-badge .avatar { width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(135deg, #7dd3fc, #38bdf8); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: bold; color: #0c1e2e; }
.user-badge .username { font-weight: 700; color: #7dd3fc; }
.container h1 { text-align: center; font-size: 20px; margin-bottom: 14px; color: #7dd3fc; }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.stat-box { background: linear-gradient(160deg, #1e1e2e, #232336); border-radius: 13px; padding: 11px 10px; text-align: center; border: 2px solid #383850; transition: all 0.35s ease; position: relative; overflow: hidden; }
.stat-box .label { font-size: 11.5px; color: #9ca3af; margin-bottom: 5px; font-weight: 500; }
.stat-box .value { font-size: 18px; font-weight: 800; color: #fbbf24; letter-spacing: 0.5px; transition: color 0.25s; }
.stat-box.safe { border-color: #22c55e; box-shadow: 0 0 18px rgba(34,197,94,0.45); background: linear-gradient(160deg, #1a2e1e, #1e3423); }
.stat-box.safe .value { color: #22c55e; }
.stat-box.gain { border-color: #22c55e; background: linear-gradient(160deg, #14301a, #1a3a22); box-shadow: 0 0 22px rgba(34,197,94,0.55); }
.stat-box.gain .value { color: #22c55e; }
.stat-box.gain::after { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at center, rgba(34,197,94,0.5), transparent 70%); animation: gainFade 0.6s ease-out forwards; pointer-events: none; }
@keyframes gainFade { from { opacity: 1; transform: scale(0.5); } to { opacity: 0; transform: scale(1.8); } }
.stat-box.lose { border-color: #ef4444; background: linear-gradient(160deg, #3a1a1e, #2a1418); box-shadow: 0 0 22px rgba(239,68,68,0.55); }
.stat-box.lose .value { color: #ef4444; }

.time-box { background: linear-gradient(160deg, #1e1e2e, #232336); border-radius: 13px; padding: 10px 14px; margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; border: 2px solid #383850; }
.time-box .label { font-size: 12.5px; color: #9ca3af; font-weight: 500; }
.time-box .value { font-size: 17px; font-weight: 800; color: #7dd3fc; }
.time-box.reward .value { color: #22c55e; }

.captcha-area { background: linear-gradient(160deg, #1a1a26, #1e1e2e); border-radius: 16px; padding: 16px; margin-bottom: 12px; text-align: center; border: 1px solid #383850; }
#captchaImg {
  width: 100%;
  max-width: 420px;
  height: 160px;
  display: block;
  margin: 0 auto;
  border-radius: 13px;
  border: 2px solid #2a2a3d;
  background: #0d0d16 url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 420 160"><text x="210" y="115" font-family="Arial" font-size="90" font-weight="bold" fill="%237dd3fc" text-anchor="middle">?</text></svg>') center/contain no-repeat;
  object-fit: contain;
}
.timer-bar { height: 12px; background: #1a1a26; border-radius: 10px; overflow: hidden; margin-top: 14px; border: 1px solid #2a2a3d; }
.timer-fill { height: 100%; width: 100%; background: linear-gradient(90deg, #22c55e, #eab308, #ef4444); transition: width 0.05s linear; }
.timer-text { font-size: 19px; font-weight: 800; color: #fbbf24; margin-top: 8px; letter-spacing: 1px; transition: color 0.3s; }
.timer-text.urgent { color: #ef4444; }
#answer { 
  width: 100%; 
  padding: 13px; 
  font-size: 26px;
  text-align: center; 
  border-radius: 13px; 
  border: 2px solid #383850; 
  background: #1a1a26; 
  color: #fff; 
  outline: none; 
  letter-spacing: 12px;
  font-weight: 800; 
  transition: 0.25s; 
}
#answer:focus { border-color: #7dd3fc; box-shadow: 0 0 0 4px rgba(125,211,252,0.15); }
#answer:disabled { opacity: 0.35; cursor: not-allowed; }

button.primary { width: 100%; padding: 13px; font-size: 16px; font-weight: 700; border: none; border-radius: 13px; cursor: pointer; transition: 0.25s; background: linear-gradient(135deg, #7dd3fc, #38bdf8); color: #0c1e2e; box-shadow: 0 6px 20px rgba(125,211,252,0.25); margin-top: 12px; }
button.primary:hover { background: linear-gradient(135deg, #38bdf8, #0ea5e9); transform: translateY(-2px); }
button.danger { width: 100%; padding: 13px; font-size: 16px; font-weight: 700; border: none; border-radius: 13px; cursor: pointer; background: linear-gradient(135deg, #ef4444, #dc2626); color: #fff; box-shadow: 0 6px 20px rgba(239,68,68,0.25); margin-top: 8px; }
button.danger:hover { background: linear-gradient(135deg, #dc2626, #b91c1c); }
#message { text-align: center; margin-top: 12px; font-size: 14px; min-height: 20px; font-weight: 700; }
.msg-good { color: #22c55e; }
.msg-bad  { color: #ef4444; }
.msg-info { color: #fbbf24; }

/* ============ SIDE MENU ============ */
.side-menu { position: fixed; top: 0; right: 0; width: 280px; height: 100vh; background: linear-gradient(160deg, #22222f, #1a1a26); border-left: 1px solid #383850; box-shadow: -10px 0 40px rgba(0,0,0,0.6); z-index: 200; padding: 20px; transform: translateX(100%); transition: transform 0.32s ease; overflow-y: auto; }
.side-menu.open { transform: translateX(0); }
.menu-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; padding-bottom: 13px; border-bottom: 1px solid #383850; }
.menu-header .title { font-size: 15px; font-weight: 700; color: #fbbf24; }
.menu-header .close-menu { width: 34px; height: 34px; padding: 0; border-radius: 10px; background: #2a2a3a; color: #fff; font-size: 15px; border: none; cursor: pointer; }
.menu-header .close-menu:hover { background: #ef4444; }
.menu-profile { background: linear-gradient(160deg, #2b2b3f, #25253a); border-radius: 13px; padding: 13px; margin-bottom: 16px; display: flex; align-items: center; gap: 12px; border: 1px solid #383850; }
.menu-profile .avatar { width: 42px; height: 42px; border-radius: 50%; background: linear-gradient(135deg, #7dd3fc, #38bdf8); display: flex; align-items: center; justify-content: center; font-size: 19px; font-weight: bold; color: #0c1e2e; }
.menu-profile .info { text-align: right; flex: 1; min-width: 0; }
.menu-profile .info .name { font-size: 13.5px; font-weight: 700; color: #7dd3fc; word-break: break-all; }
.menu-profile .info .phone { font-size: 11px; color: #9ca3af; margin-top: 3px; }
.menu-item { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; background: linear-gradient(160deg, #2b2b3f, #25253a); border-radius: 12px; margin-bottom: 8px; cursor: pointer; transition: all 0.22s; font-size: 13.5px; color: #d1d5db; border: 1px solid transparent; }
.menu-item:hover { background: linear-gradient(160deg, #32324a, #2a2a40); border-color: #7dd3fc; transform: translateX(-4px); }
.menu-item .left { display: flex; align-items: center; gap: 10px; }
.menu-item .arrow { color: #6b7280; font-size: 15px; }
.menu-item.danger { color: #ef4444; }
.menu-item.danger:hover { border-color: #ef4444; background: linear-gradient(160deg, #3a1e22, #2a1a1e); }
.menu-item.withdraw-active { color: #22c55e; border-color: rgba(34,197,94,0.4); }
.menu-divider { height: 1px; background: #383850; margin: 12px 0; }
.menu-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 150; opacity: 0; visibility: hidden; transition: 0.3s; }
.menu-overlay.open { opacity: 1; visibility: visible; }

/* ============ MODALS ============ */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.72); display: flex; justify-content: center; align-items: center; padding: 16px; z-index: 300; animation: fadeIn 0.22s; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal { width: 100%; max-width: 420px; background: linear-gradient(160deg, #2b2b3f, #22222f); border-radius: 20px; padding: 20px; max-height: 90vh; overflow-y: auto; animation: popIn 0.28s ease; border: 1px solid rgba(125,211,252,0.1); }
@keyframes popIn { from { transform: scale(0.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid #383850; }
.modal-header h2 { font-size: 16px; color: #fbbf24; font-weight: 700; }
.close-btn { width: 34px; height: 34px; padding: 0; border-radius: 10px; background: #2a2a3a; color: #fff; font-size: 17px; border: none; cursor: pointer; }
.close-btn:hover { background: #ef4444; }

/* ============ PACKAGES ============ */
.packages { display: flex; flex-direction: column; gap: 10px; }
.pkg { display: flex; justify-content: space-between; align-items: center; padding: 13px; background: linear-gradient(160deg, #1e1e2e, #232336); border-radius: 13px; border: 2px solid #383850; cursor: pointer; transition: all 0.22s; }
.pkg:hover { border-color: #7dd3fc; transform: translateX(-4px); }
.pkg.owned-pkg { border-color: #22c55e; background: linear-gradient(160deg, #14261a, #1a2e20); cursor: not-allowed; }
.pkg.owned-pkg:hover { transform: none; }
.pkg .info { text-align: right; }
.pkg .name { font-size: 13.5px; font-weight: 700; }
.pkg .bonus { font-size: 11px; color: #9ca3af; margin-top: 4px; }
.pkg .buy-area { text-align: left; }
.pkg .price { font-size: 17px; font-weight: 800; color: #22c55e; }
.pkg .timer-left { font-size: 10.5px; color: #fbbf24; margin-top: 3px; }

/* ============ FORMS ============ */
.form-group { margin-bottom: 13px; }
.form-group label { display: block; font-size: 12.5px; color: #9ca3af; margin-bottom: 6px; font-weight: 500; }
.form-group input, .form-group select { width: 100%; padding: 12px; font-size: 13.5px; border-radius: 11px; border: 2px solid #383850; background: #1a1a26; color: #fff; outline: none; transition: 0.25s; font-family: inherit; }
.form-group input:focus, .form-group select:focus { border-color: #22c55e; box-shadow: 0 0 0 4px rgba(34,197,94,0.12); }
.form-group .hint { font-size: 11px; color: #6b7280; margin-top: 5px; }

.balance-info { background: linear-gradient(160deg, #14261a, #1a2e20); border: 2px solid #22c55e; border-radius: 12px; padding: 12px; text-align: center; margin-bottom: 16px; }
.balance-info .lbl { font-size: 11.5px; color: #9ca3af; margin-bottom: 4px; }
.balance-info .amt { font-size: 21px; font-weight: 800; color: #22c55e; }
#confirmWithdraw { background: linear-gradient(135deg, #22c55e, #16a34a); color: #062b14; }
#confirmWithdraw:hover { background: linear-gradient(135deg, #16a34a, #15803d); }

.success-screen { text-align: center; padding: 8px 0; }
.success-screen .icon { font-size: 58px; margin-bottom: 12px; }
.success-screen h3 { color: #22c55e; font-size: 17px; margin-bottom: 10px; }
.success-screen p { font-size: 12.5px; color: #9ca3af; line-height: 1.8; margin-bottom: 6px; }
.success-screen .addr { background: #1a1a26; border-radius: 10px; padding: 11px; font-family: 'Courier New', monospace; font-size: 12px; color: #7dd3fc; word-break: break-all; margin-top: 10px; border: 1px solid #383850; white-space: pre-line; }

/* ============ RULES ============ */
.rules { font-size: 12.5px; line-height: 2; color: #d1d5db; }
.rules li { margin-right: 18px; margin-bottom: 6px; list-style: none; }
.rules li::before { content: '• '; color: #7dd3fc; }
.rules .highlight { color: #fbbf24; font-weight: bold; }
.rules .good { color: #22c55e; font-weight: bold; }
.rules .bad  { color: #ef4444; font-weight: bold; }

/* ============ HISTORY ============ */
.history-empty { text-align: center; padding: 30px 10px; color: #6b7280; font-size: 13px; }
.history-empty .icon { font-size: 42px; margin-bottom: 12px; opacity: 0.5; }
.history-list { display: flex; flex-direction: column; gap: 10px; }
.history-item { background: linear-gradient(160deg, #1e1e2e, #232336); border-radius: 12px; padding: 12px 14px; border-right: 3px solid #7dd3fc; font-size: 12.5px; }
.history-item .row1 { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.history-item .amount { font-weight: 800; color: #fbbf24; font-size: 14px; }
.history-item .date { font-size: 11px; color: #6b7280; }
.history-item .detail { font-size: 11px; color: #9ca3af; word-break: break-all; margin-top: 5px; }
.status-badge { display: inline-block; font-size: 10px; padding: 4px 11px; border-radius: 20px; font-weight: 700; margin-top: 5px; }
.status-pending  { background: rgba(251,191,36,0.15); color: #fbbf24; border: 1px solid #fbbf24; }
.status-review   { background: rgba(125,211,252,0.15); color: #7dd3fc; border: 1px solid #7dd3fc; }
.status-approved { background: rgba(34,197,94,0.15); color: #22c55e; border: 1px solid #22c55e; }
.status-rejected { background: rgba(239,68,68,0.15); color: #ef4444; border: 1px solid #ef4444; }
/* ============ ANNOUNCEMENT ============ */
.announcement-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, #7c2d12, #b45309);
  border: 2px solid #fbbf24;
  border-radius: 13px;
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 13px;
  color: #fff;
  box-shadow: 0 4px 20px rgba(251,191,36,0.25);
  animation: annSlide 0.4s ease;
}
@keyframes annSlide {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.announcement-bar .ann-icon {
  font-size: 18px;
  flex-shrink: 0;
}
.announcement-bar .ann-text {
  flex: 1;
  line-height: 1.6;
  word-break: break-word;
}
.announcement-bar .ann-close {
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
}
.announcement-bar .ann-close:hover {
  background: rgba(255,255,255,0.3);
}
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #22c55e; color: #062b14; padding: 12px 22px; border-radius: 12px; font-weight: bold; font-size: 13px; z-index: 999; animation: popIn 0.3s; }
.toast.bad { background: #ef4444; color: #fff; }

.loading-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 500; display: flex; align-items: center; justify-content: center; }
.spinner { width: 44px; height: 44px; border: 4px solid rgba(125,211,252,0.2); border-top-color: #7dd3fc; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }