/* ════════════════════════════════════════════════════════════════════
   TRADING ROBOT — Mini App
   Brand tokens mirror the design system (colors_and_type.css). Dark only,
   single orange accent, mono eyebrows, borders-as-depth, trading semantics.
   RTL / Vazirmatn first (the bot is Persian).
   ════════════════════════════════════════════════════════════════════ */

@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap");

@font-face {
  font-family: "Vazirmatn";
  src: url("https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/fonts/webfonts/Vazirmatn-Regular.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Vazirmatn";
  src: url("https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/fonts/webfonts/Vazirmatn-Medium.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Vazirmatn";
  src: url("https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/fonts/webfonts/Vazirmatn-SemiBold.woff2") format("woff2");
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Vazirmatn";
  src: url("https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/fonts/webfonts/Vazirmatn-Bold.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}

:root {
  --bg:           #0E1117;
  --bg-elev:      #131B2C;
  --bg-card:      #162030;
  --bg-deep:      #0B0F1A;
  --bg-deeper:    #090E18;
  --bg-darkest:   #07070A;

  --fg:           #E8EDF4;
  --fg-dim:       #9BA8BF;
  --muted:        #5A6478;
  --on-accent:    #0A0A0B;

  --border:        #1A2438;
  --border-strong: #263450;

  --accent:       #FF7A1A;
  --accent-2:     #FFA15C;
  --accent-deep:  #C87828;
  --accent-glow:  rgba(255,122,26,0.35);
  --accent-soft:  rgba(255,122,26,0.08);
  --accent-tint:  rgba(255,122,26,0.14);

  --green:        #26A69A;
  --green-2:      #5BC28C;
  --red:          #EF5350;
  --red-2:        #E85454;

  --tag-tesla:    #FF7A1A;
  --tag-bank:     #5FB3FF;
  --tag-team45:   #9B8CFF;

  --font-fa:      "Vazirmatn", "Tahoma", sans-serif;
  --font-mono:    "JetBrains Mono", "Vazirmatn", monospace;
  --font-display: "Space Grotesk", "Vazirmatn", sans-serif;

  --radius:      4px;
  --radius-md:   8px;
  --radius-card: 14px;
  --radius-xl:   18px;
  --radius-pill: 999px;

  --shadow-cta:  0 8px 24px -10px var(--accent-glow);
  --shadow-card: 0 20px 48px -20px rgba(0,0,0,0.8);

  --ease-snap:   cubic-bezier(0.4, 0, 0.2, 1);
  --t-base:      0.18s;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-fa);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  letter-spacing: 0;
}

body { padding-bottom: 78px; }   /* room for bottom nav */

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
::selection { background: var(--accent); color: var(--on-accent); }

/* ─── subtle data-grid field behind the app (the brand's hero motif) ─── */
.bg-field {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image: repeating-linear-gradient(
    0deg, transparent 0 67px, rgba(38,166,154,0.06) 67px 68px);
  -webkit-mask-image: radial-gradient(ellipse 90% 60% at 50% 25%, #000 0%, transparent 80%);
          mask-image: radial-gradient(ellipse 90% 60% at 50% 25%, #000 0%, transparent 80%);
}
.bg-glow {
  position: fixed; top: -240px; right: -200px; width: 420px; height: 420px;
  background: var(--accent); filter: blur(120px); opacity: 0.10;
  z-index: -1; pointer-events: none;
}

/* ════════════════════ Typography helpers ════════════════════ */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.eyebrow::before {
  content: ""; width: 6px; height: 6px; background: var(--accent);
  display: inline-block; border-radius: 1px;
}
.mono { font-family: var(--font-mono); }
.t-accent { color: var(--accent); }
.t-green  { color: var(--green); }
.t-red    { color: var(--red-2); }
.t-dim    { color: var(--fg-dim); }
.t-muted  { color: var(--muted); }

h1, h2, h3 { font-family: var(--font-display); margin: 0; font-weight: 700; line-height: 1.2; }

/* ════════════════════ Layout shell ════════════════════ */
.app { max-width: 560px; margin: 0 auto; padding: 14px 16px 24px; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 6px 2px 16px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { width: 34px; height: 34px; background: #fff; padding: 3px; border-radius: 8px; }
.brand .wm { font-family: var(--font-display); font-weight: 700; font-size: 16px; }
.brand .wm b { color: var(--accent); font-weight: 700; }

.live-chip {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--font-mono); font-size: 11px; color: var(--green-2);
  border: 1px solid var(--border); border-radius: var(--radius-pill);
  padding: 5px 11px; background: var(--bg-deep);
}
.live-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--green-2);
  box-shadow: 0 0 0 0 rgba(91,194,140,0.6); animation: ping 1.7s infinite;
}
@keyframes ping {
  0%   { box-shadow: 0 0 0 0 rgba(91,194,140,0.55); }
  70%  { box-shadow: 0 0 0 8px rgba(91,194,140,0); }
  100% { box-shadow: 0 0 0 0 rgba(91,194,140,0); }
}

/* ════════════════════ Cards ════════════════════ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 18px;
  transition: border-color var(--t-base), transform var(--t-base);
}
.card.tap:active { transform: translateY(1px); border-color: var(--border-strong); }

.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 22px 2px 12px; }
.section-title h2 { font-size: 19px; }
.section-title .hint { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }

/* ── hero credits card ── */
.hero {
  background:
    radial-gradient(circle at 88% 12%, rgba(255,122,26,0.16), transparent 52%),
    var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 22px;
  box-shadow: var(--shadow-card);
}
.hero .label { font-family: var(--font-mono); font-size: 11px; color: var(--fg-dim); letter-spacing: 0.04em; }
.hero .credits {
  font-family: var(--font-display); font-weight: 700;
  font-size: 46px; line-height: 1.05; margin-top: 6px;
  display: flex; align-items: baseline; gap: 8px;
}
.hero .credits .unit { font-size: 15px; color: var(--accent); font-family: var(--font-mono); }
.hero .sub { color: var(--fg-dim); font-size: 13.5px; margin-top: 4px; }

/* ── stat tiles ── */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.stat {
  background: var(--bg-deep); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 12px 10px; text-align: center;
}
.stat .v { font-family: var(--font-display); font-weight: 700; font-size: 19px; }
.stat .k { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ── progress bar ── */
.bar { height: 8px; border-radius: var(--radius-pill); background: var(--bg-deep); overflow: hidden; border: 1px solid var(--border); }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent-deep), var(--accent)); border-radius: var(--radius-pill); transition: width 0.5s var(--ease-snap); }
.bar.green > i { background: linear-gradient(90deg, #1c7d74, var(--green)); }

/* ════════════════════ Product (arsenal) cards ════════════════════ */
.product { margin-bottom: 12px; }
.product .head { display: flex; align-items: center; gap: 12px; }
.tag {
  font-family: var(--font-mono); font-size: 12px; font-weight: 600; letter-spacing: 0.08em;
  border: 1px solid currentColor; border-radius: var(--radius); padding: 5px 9px;
  min-width: 46px; text-align: center;
}
.product .name { font-family: var(--font-display); font-weight: 600; font-size: 16px; flex: 1; }
.product .meta { display: flex; justify-content: space-between; margin: 12px 0 8px; font-size: 13px; color: var(--fg-dim); }
.product .meta .mono { color: var(--fg); }
.product .status { font-family: var(--font-mono); font-size: 11.5px; margin-top: 9px; }

/* ════════════════════ Buttons ════════════════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; border: none; border-radius: var(--radius); padding: 13px 16px;
  font-weight: 700; font-size: 15px; font-family: var(--font-fa);
  background: var(--accent); color: var(--on-accent); box-shadow: var(--shadow-cta);
  transition: background var(--t-base), transform var(--t-base), opacity var(--t-base);
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; box-shadow: none; }
.btn.ghost { background: transparent; color: var(--fg); border: 1px solid var(--border-strong); box-shadow: none; }
.btn.green { background: var(--green); color: #06120f; box-shadow: 0 8px 24px -10px rgba(38,166,154,0.5); }
.btn-row { margin-top: 12px; }

/* ════════════════════ Leaderboard ════════════════════ */
.lb-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.lb-row:last-child { border-bottom: none; }
.lb-row.me { background: var(--accent-soft); border-radius: var(--radius-md); }
.lb-rank { font-family: var(--font-mono); font-weight: 600; width: 30px; color: var(--muted); font-size: 14px; }
.lb-name { flex: 1; font-size: 14.5px; }
.lb-amt { font-family: var(--font-mono); font-size: 13.5px; color: var(--accent); }
.lb-you {
  margin-top: 14px; padding: 14px; border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md); text-align: center; color: var(--fg-dim); font-size: 13.5px;
}
.lb-you b { color: var(--fg); font-family: var(--font-display); }

/* ════════════════════ Pills / status ════════════════════ */
.pill {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.06em;
  padding: 4px 9px; border-radius: var(--radius); border: 1px solid currentColor;
}
.pill.pending  { color: var(--accent); }
.pill.approved { color: var(--green); }
.pill.cancelled, .pill.rejected { color: var(--red-2); }

/* claim history rows */
.claim-row { display: flex; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--border); }
.claim-row:last-child { border-bottom: none; }
.claim-row .emoji { font-size: 22px; }
.claim-row .info { flex: 1; }
.claim-row .info .t { font-size: 14.5px; }
.claim-row .info .s { font-size: 12px; color: var(--muted); font-family: var(--font-mono); }

/* ════════════════════ Profile rows ════════════════════ */
.kv { display: flex; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border); font-size: 14.5px; }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--fg-dim); }
.kv .v { font-family: var(--font-mono); }

/* ════════════════════ Bottom nav ════════════════════ */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; justify-content: space-around;
  background: rgba(11,15,26,0.94); backdrop-filter: blur(22px) saturate(170%);
  border-top: 1px solid var(--border);
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
}
.nav button {
  flex: 1; background: none; border: none; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-family: var(--font-fa); font-size: 11px; padding: 4px;
  transition: color var(--t-base);
}
.nav button .ic { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.7; }
.nav button.active { color: var(--accent); }

/* ════════════════════ Bottom sheet (claim) ════════════════════ */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 50; background: rgba(7,7,10,0.7);
  backdrop-filter: blur(4px); opacity: 0; pointer-events: none; transition: opacity var(--t-base);
}
.sheet-backdrop.open { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 51;
  background: var(--bg-card); border-top: 1px solid var(--border-strong);
  border-radius: 20px 20px 0 0; padding: 20px 18px calc(22px + env(safe-area-inset-bottom));
  transform: translateY(110%); transition: transform 0.32s var(--ease-snap);
  max-width: 560px; margin: 0 auto;
}
.sheet.open { transform: translateY(0); }
.sheet .grip { width: 42px; height: 4px; border-radius: 99px; background: var(--border-strong); margin: 0 auto 16px; }
.sheet h3 { font-size: 19px; margin-bottom: 4px; }
.sheet .lead { color: var(--fg-dim); font-size: 13.5px; margin-bottom: 16px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-family: var(--font-mono); font-size: 11px; color: var(--muted); letter-spacing: 0.04em; margin-bottom: 7px; }
.field input {
  width: 100%; background: var(--bg-deep); border: 1px solid var(--border); color: var(--fg);
  border-radius: var(--radius-md); padding: 12px 14px; font-family: var(--font-fa); font-size: 15px;
}
.field input:focus { outline: none; border-color: var(--accent); }

.stepper { display: flex; align-items: center; gap: 12px; }
.stepper button {
  width: 44px; height: 44px; border-radius: var(--radius-md); border: 1px solid var(--border-strong);
  background: var(--bg-deep); color: var(--fg); font-size: 22px; font-family: var(--font-mono);
}
.stepper .val { flex: 1; text-align: center; font-family: var(--font-display); font-weight: 700; font-size: 24px; }
.stepper .val small { display: block; font-size: 11px; color: var(--muted); font-weight: 400; font-family: var(--font-mono); }
.cost-line { display: flex; justify-content: space-between; font-size: 13.5px; color: var(--fg-dim); margin: 4px 2px 16px; }
.cost-line b { color: var(--accent); font-family: var(--font-mono); }

/* ════════════════════ States / misc ════════════════════ */
.gate { text-align: center; padding: 60px 24px; }
.gate .mark { width: 64px; height: 64px; background: #fff; padding: 6px; border-radius: 14px; margin: 0 auto 20px; }
.gate h2 { font-size: 22px; margin-bottom: 10px; }
.gate p { color: var(--fg-dim); margin-bottom: 22px; }

.skeleton { background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-elev) 50%, var(--bg-card) 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: var(--radius-card); }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%) translateY(20px);
  z-index: 60; background: var(--bg-elev); border: 1px solid var(--border-strong);
  color: var(--fg); padding: 12px 18px; border-radius: var(--radius-md); font-size: 14px;
  box-shadow: var(--shadow-card); opacity: 0; pointer-events: none; transition: all var(--t-base);
  max-width: 90%; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { border-color: var(--red-2); }
.toast.ok  { border-color: var(--green); }

.view { display: none; }
.view.active { display: block; animation: fade 0.2s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.empty { text-align: center; color: var(--muted); padding: 30px 10px; font-size: 13.5px; }
