:root {
  --bg0: #050a14;
  --bg1: #0b1220;
  --panel: rgba(20, 30, 51, 0.85);
  --stroke: #243352;
  --cyan: #22d3ee;
  --blue: #3b82f6;
  --gold: #f5c542;
  --text: #e8eefc;
  --muted: #8b9bb8;
  --danger: #f87171;
  --ok: #4ade80;
  --safe-bot: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Vazirmatn", sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  min-height: 100%;
  background: var(--bg0);
  color: var(--text);
  font-family: var(--font);
  direction: rtl;
}
body {
  background:
    radial-gradient(1000px 500px at 90% -10%, rgba(59,130,246,.2), transparent 55%),
    radial-gradient(800px 400px at 0% 30%, rgba(34,211,238,.12), transparent 50%),
    linear-gradient(180deg, var(--bg1), var(--bg0));
  padding-top: var(--safe-top);
  padding-bottom: calc(16px + var(--safe-bot));
}
.app { max-width: 430px; margin: 0 auto; min-height: 100dvh; padding: 0 0 24px; }

.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  position: sticky; top: 0; z-index: 10;
  backdrop-filter: blur(12px);
  background: linear-gradient(180deg, rgba(5,10,20,.95), rgba(5,10,20,.5));
}
.logo { display: flex; gap: 10px; align-items: center; }
.badge {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, #f5c542, #d4a017);
  display: grid; place-items: center;
  font-weight: 800; font-size: 11px; color: #1a1200;
  box-shadow: 0 0 16px rgba(245,197,66,.35);
}
.logo h1 { font-size: 15px; letter-spacing: .04em; }
.logo small { display: block; color: var(--muted); font-size: 11px; }

.bal-chip {
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 700; font-size: 14px;
}
.bal-chip bdi { direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums; }

.hero {
  margin: 8px 16px 14px;
  padding: 18px;
  border-radius: 20px;
  border: 1px solid var(--stroke);
  background: linear-gradient(145deg, rgba(34,211,238,.1), transparent 45%), var(--panel);
  box-shadow: 0 0 28px rgba(34,211,238,.18);
}
.hero h2 { font-size: 20px; margin-bottom: 6px; }
.hero p { color: var(--muted); font-size: 13px; line-height: 1.5; }

.balance-xl {
  text-align: center;
  padding: 20px 16px;
  margin: 0 16px 14px;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--stroke);
}
.balance-xl label { display: block; color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.balance-xl .n {
  font-size: 40px; font-weight: 800; color: var(--cyan);
  text-shadow: 0 0 20px rgba(34,211,238,.35);
  direction: ltr; unicode-bidi: isolate;
}

.card {
  margin: 0 16px 12px;
  padding: 16px;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--stroke);
}
.card h3 { font-size: 13px; color: var(--muted); margin-bottom: 12px; font-weight: 600; }

.btn {
  display: flex; width: 100%; align-items: center; justify-content: center;
  min-height: 48px; border: 0; border-radius: 14px;
  font-size: 15px; font-weight: 700; font-family: inherit; cursor: pointer;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary {
  color: #041018;
  background: linear-gradient(135deg, #22d3ee, #3b82f6);
  box-shadow: 0 0 20px rgba(34,211,238,.28);
}
.btn-gold {
  color: #1a1200;
  background: linear-gradient(135deg, #f5c542, #e8a912);
}
.btn-ghost {
  background: transparent; color: var(--text); border: 1px solid var(--stroke);
}
.row { display: flex; gap: 10px; }
.row .btn { flex: 1; }

.timer {
  direction: ltr; text-align: center;
  font-size: 30px; font-weight: 700; letter-spacing: .06em;
  padding: 12px; margin-bottom: 12px;
  border-radius: 12px;
  background: rgba(5,10,20,.55);
  border: 1px solid var(--stroke);
  color: var(--cyan);
  font-variant-numeric: tabular-nums;
}
.timer.ready { color: var(--ok); border-color: rgba(74,222,128,.35); }

.reward { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.reward b { color: var(--cyan); font-size: 22px; }

.list { list-style: none; }
.list li {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 10px 0;
  border-bottom: 1px solid var(--stroke);
  font-size: 14px;
}
.list li:last-child { border-bottom: 0; }
.list .code { font-weight: 700; direction: ltr; unicode-bidi: isolate; }
.list .acts { display: flex; gap: 6px; }
.list .acts button {
  border: 0; border-radius: 10px; padding: 8px 10px;
  font-size: 12px; font-weight: 700; font-family: inherit; cursor: pointer;
}
.list .lease { background: linear-gradient(135deg,#22d3ee,#3b82f6); color: #041018; }
.list .buy { background: linear-gradient(135deg,#f5c542,#e8a912); color: #1a1200; }

.gate {
  min-height: 80dvh; display: flex; align-items: center; justify-content: center;
  padding: 24px 16px;
}
.gate-box {
  width: 100%; text-align: center;
  padding: 28px 18px; border-radius: 20px;
  background: var(--panel); border: 1px solid var(--stroke);
}
.gate-box h2 { margin: 12px 0 8px; }
.gate-box p { color: var(--muted); font-size: 13px; line-height: 1.55; margin-bottom: 16px; }

.toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(20px + var(--safe-bot));
  max-width: 400px; margin: 0 auto; z-index: 50;
  background: rgba(20,30,51,.96); border: 1px solid var(--stroke);
  border-radius: 14px; padding: 12px 14px; font-size: 13px;
  transform: translateY(140%); opacity: 0; transition: .25s ease;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.err { border-color: rgba(248,113,113,.55); }
.toast.ok { border-color: rgba(74,222,128,.45); }

.muted { color: var(--muted); font-size: 12px; }
.hidden { display: none !important; }
.spinner {
  width: 28px; height: 28px; margin: 12px auto;
  border: 3px solid var(--stroke); border-top-color: var(--cyan);
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.status-line { text-align: center; color: var(--muted); font-size: 12px; padding: 8px; }
