:root {
  --bg: #07070c;
  --surface: #12121a;
  --surface2: #1a1a26;
  --elevated: #222233;
  --text: #f4f4fa;
  --muted: #9399b0;
  --pink: #f472b6;
  --rose: #fb7185;
  --violet: #a78bfa;
  --cyan: #67e8f9;
  --ok: #4ade80;
  --warn: #fbbf24;
  --err: #f87171;
  --line: rgba(255, 255, 255, 0.07);
  --radius: 16px;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "IBM Plex Sans Arabic", "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 90% 55% at 50% -15%, rgba(167, 139, 250, 0.28), transparent 55%),
    radial-gradient(ellipse 50% 40% at 0% 80%, rgba(244, 114, 182, 0.1), transparent),
    radial-gradient(ellipse 40% 35% at 100% 60%, rgba(103, 232, 249, 0.08), transparent);
  pointer-events: none;
  z-index: 0;
}

.shell {
  position: relative;
  z-index: 1;
  max-width: 460px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 0 18px max(20px, env(safe-area-inset-bottom));
}

.top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 2px 8px;
}

.brand-logo {
  display: block;
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  background: linear-gradient(120deg, var(--violet), var(--pink));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand-sub {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 600;
  margin-top: 2px;
}

.auth-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.auth-email {
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 600;
}

.secure-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
  color: var(--muted);
  background: rgba(74, 222, 128, 0.08);
  border: 1px solid rgba(74, 222, 128, 0.22);
  border-radius: 12px;
  padding: 8px 12px;
  margin-bottom: 14px;
}

.ico-lock {
  color: var(--ok);
  flex-shrink: 0;
}

.main {
  flex: 1;
}

.hidden {
  display: none !important;
}

.balance-card {
  background: linear-gradient(145deg, var(--surface), var(--surface2));
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 18px 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}

.bal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.bal-title {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--muted);
}

.icon-btn {
  border: 1px solid var(--line);
  background: var(--elevated);
  color: var(--text);
  width: 36px;
  height: 36px;
  border-radius: 10px;
  font-size: 1.1rem;
  cursor: pointer;
}

.bal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.bal-item {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 12px;
  text-align: center;
}

.bal-coins .bal-value {
  color: var(--pink);
}

.bal-points .bal-value {
  color: var(--cyan);
}

.bal-label {
  display: block;
  font-size: 0.7rem;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 6px;
}

.bal-value {
  font-size: 1.55rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.seg {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface);
  border-radius: 14px;
  border: 1px solid var(--line);
  margin-bottom: 14px;
}

.seg-btn {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  padding: 11px 4px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.seg-btn.active {
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.4), rgba(244, 114, 182, 0.28));
  color: var(--text);
  box-shadow: 0 2px 12px rgba(167, 139, 250, 0.2);
}

.steps-hint {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: flex;
  gap: 6px;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--muted);
}

.steps-hint li {
  flex: 1;
  text-align: center;
  padding: 6px 4px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.steps-hint li.on {
  color: var(--text);
  border-color: rgba(167, 139, 250, 0.45);
  background: rgba(167, 139, 250, 0.12);
}

.hint-box {
  margin: 0 0 10px;
  padding: 10px 12px;
  font-size: 0.8rem;
  color: var(--muted);
  background: var(--surface);
  border-radius: 12px;
  border: 1px dashed var(--line);
  line-height: 1.5;
}

.chips {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.chip {
  flex: 1;
  border: 1px solid var(--line);
  background: var(--surface2);
  color: var(--muted);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  padding: 12px 8px;
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.chip.active {
  border-color: var(--violet);
  color: var(--text);
  background: rgba(167, 139, 250, 0.18);
  box-shadow: 0 0 0 1px rgba(167, 139, 250, 0.25);
}

.pack-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pack-card {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 0.15s;
}

.pack-card.featured {
  border-color: rgba(167, 139, 250, 0.5);
  background: linear-gradient(135deg, var(--surface), rgba(167, 139, 250, 0.08));
}

.pack-coins {
  font-size: 1.3rem;
  font-weight: 800;
}

.pack-sub {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 600;
  margin-top: 2px;
}

.pack-price {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--pink);
  text-align: left;
}

.btn {
  border: none;
  border-radius: 12px;
  font-family: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  width: 100%;
  padding: 15px;
  background: linear-gradient(135deg, #8b5cf6, var(--pink));
  color: #fff;
  font-size: 0.95rem;
  box-shadow: 0 8px 24px rgba(139, 92, 246, 0.35);
}

.btn-buy {
  padding: 10px 16px;
  background: linear-gradient(135deg, var(--violet), var(--pink));
  color: #fff;
  font-size: 0.82rem;
  white-space: nowrap;
}

.btn-ghost {
  padding: 10px 16px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 0.82rem;
}

.card-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}

.lbl {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 700;
}

.inp {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  border-radius: 12px;
  padding: 13px 14px;
  font-family: inherit;
  font-size: 1rem;
}

.inp-area {
  resize: vertical;
  min-height: 88px;
}

.inp:focus {
  outline: none;
  border-color: var(--violet);
  box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.2);
}

.field-hint {
  margin: -4px 0 4px;
  font-size: 0.72rem;
  color: var(--muted);
}

.quick-amt {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quick-amt button {
  border: 1px solid var(--line);
  background: var(--surface2);
  color: var(--text);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
}

.quick-amt button.active {
  border-color: var(--cyan);
  background: rgba(103, 232, 249, 0.12);
}

.chk {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.82rem;
  color: var(--muted);
  cursor: pointer;
  margin-top: 4px;
}

.chk input {
  margin-top: 3px;
  accent-color: var(--violet);
}

.muted-note {
  margin-top: 12px;
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.5;
  text-align: center;
}

.sub-seg {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.sub-seg-btn {
  flex: 1;
  border: 1px solid var(--line);
  background: var(--surface2);
  color: var(--muted);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 10px;
  border-radius: 10px;
  cursor: pointer;
}

.sub-seg-btn.active {
  color: var(--text);
  border-color: var(--violet);
  background: rgba(167, 139, 250, 0.15);
}

.orders-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.order-row {
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.order-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.order-id {
  font-weight: 800;
  font-size: 0.95rem;
}

.order-meta {
  margin-top: 6px;
  font-size: 0.8rem;
  color: var(--muted);
}

.badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.badge.pending {
  background: rgba(251, 191, 36, 0.15);
  color: var(--warn);
}

.badge.completed {
  background: rgba(74, 222, 128, 0.15);
  color: var(--ok);
}

.badge.rejected {
  background: rgba(248, 113, 113, 0.15);
  color: var(--err);
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 36px 16px;
  font-size: 0.9rem;
}

.toast {
  margin-top: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(74, 222, 128, 0.1);
  border: 1px solid rgba(74, 222, 128, 0.35);
  font-size: 0.88rem;
  line-height: 1.5;
}

.toast.error {
  background: rgba(248, 113, 113, 0.1);
  border-color: rgba(248, 113, 113, 0.4);
  color: var(--err);
}

.auth-screen {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 0 40px;
}

.auth-card {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 28px 22px;
  box-shadow: var(--shadow);
}

.auth-icon {
  font-size: 2rem;
  text-align: center;
  margin-bottom: 8px;
}

.auth-title {
  margin: 0;
  text-align: center;
  font-size: 1.45rem;
  font-weight: 800;
}

.auth-sub {
  margin: 8px 0 22px;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}

.pwd-wrap {
  position: relative;
}

.pwd-wrap .inp {
  padding-left: 44px;
}

.pwd-toggle {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 1rem;
  opacity: 0.7;
}

.err {
  margin-top: 10px;
  color: var(--rose);
  font-size: 0.82rem;
  text-align: center;
}

.footer {
  text-align: center;
  padding: 22px 8px;
  font-size: 0.76rem;
  color: var(--muted);
}

.footer a {
  color: var(--muted);
  text-decoration: none;
}

.footer a:hover {
  color: var(--pink);
}

.loader {
  position: fixed;
  inset: 0;
  background: rgba(7, 7, 12, 0.72);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 90;
}

.spin {
  width: 40px;
  height: 40px;
  border: 3px solid var(--line);
  border-top-color: var(--pink);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.modal-back {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
}

.modal {
  width: 100%;
  max-width: 440px;
  max-height: 85vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px 22px 18px 18px;
  padding: 22px 18px;
  box-shadow: var(--shadow);
  position: relative;
}

.modal-close {
  position: absolute;
  top: 12px;
  left: 12px;
  border: none;
  background: var(--elevated);
  color: var(--text);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 1.2rem;
  cursor: pointer;
}

.modal-title {
  margin: 0 0 8px;
  font-size: 1.2rem;
  font-weight: 800;
  text-align: center;
}

.modal-order {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--pink);
  margin: 0 0 12px;
}

.modal-body {
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  margin: 0 0 12px;
  direction: rtl;
}

.modal-steps {
  margin: 0 0 16px;
  padding-right: 20px;
  font-size: 0.82rem;
  color: var(--text);
  line-height: 1.6;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

@media (min-width: 520px) {
  .modal-back {
    align-items: center;
  }

  .modal {
    border-radius: 22px;
  }
}
