/* p2win Mini App — glass style from docs/design-main.dc.html (board Main).
   Palette (CLAUDE.md): #0A0620 / #140C38 / #1B1145 / #7C3AED / #A78BFA / #C084FC / #D946EF; #22D3EE only in the logo. */
/* Vazirmatn, self-hosted from the official repository (github.com/rastikerdar/vazirmatn),
   SIL Open Font License 1.1 — see fonts/OFL.txt and fonts/AUTHORS.txt. No Google Fonts. */
@font-face { font-family: 'Vazirmatn'; src: url('fonts/Vazirmatn-Regular.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Vazirmatn'; src: url('fonts/Vazirmatn-Medium.woff2') format('woff2'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'Vazirmatn'; src: url('fonts/Vazirmatn-Bold.woff2') format('woff2'); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'Vazirmatn'; src: url('fonts/Vazirmatn-ExtraBold.woff2') format('woff2'); font-weight: 800; font-style: normal; font-display: swap; }

:root {
  --bg: #0A0620;
  --bg2: #140C38;
  --surface: rgba(255, 255, 255, .08);
  --surface-strong: rgba(255, 255, 255, .12);
  --border: rgba(255, 255, 255, .16);
  --text: #F4F1FF;
  --muted: #B7AEE0;
  --soft: #E9E3FF;
  --accent-text: #C4B5FD;
  --tabbar: rgba(20, 12, 56, .78);
  --hero-base: #1B1145;
  --hero-base2: #0F0A2E;
  --ghost: rgba(255, 255, 255, .06);
  --input: rgba(255, 255, 255, .06);
  --shadow-inset: inset 0 1px 0 rgba(255, 255, 255, .18);
  --glow-a: rgba(124, 58, 237, .7);
  --glow-b: rgba(217, 70, 239, .4);
  --radius-card: 22px;
}
:root[data-theme="light"] {
  --bg: #F1EDFF;
  --bg2: #E7E0FF;
  --surface: rgba(255, 255, 255, .62);
  --surface-strong: rgba(255, 255, 255, .8);
  --border: rgba(27, 17, 69, .12);
  --text: #1B1145;
  --muted: #5B4E8C;
  --soft: #3B2F6B;
  --accent-text: #7C3AED;
  --tabbar: rgba(255, 255, 255, .82);
  --hero-base: #EDE7FF;
  --hero-base2: #F6F3FF;
  --ghost: rgba(27, 17, 69, .06);
  --input: rgba(255, 255, 255, .7);
  --shadow-inset: inset 0 1px 0 rgba(255, 255, 255, .7);
  --glow-a: rgba(124, 58, 237, .28);
  --glow-b: rgba(217, 70, 239, .18);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: 'Vazirmatn', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
  background: var(--bg); color: var(--text); overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}
button { font-family: inherit; cursor: pointer; color: inherit; }
input { font-family: inherit; }
a { color: var(--accent-text); }
.ltr { direction: ltr; unicode-bidi: isolate; }
code, .mono { font-family: ui-monospace, 'SFMono-Regular', Consolas, monospace; direction: ltr; unicode-bidi: isolate; word-break: break-all; }

.glow { position: fixed; border-radius: 50%; pointer-events: none; z-index: 0; }
.glow-a { top: -120px; inset-inline-end: -100px; width: 360px; height: 360px; background: radial-gradient(circle, var(--glow-a), transparent 70%); }
.glow-b { bottom: 60px; inset-inline-start: -120px; width: 380px; height: 380px; background: radial-gradient(circle, var(--glow-b), transparent 70%); }

#layout { position: relative; z-index: 1; }
#view { padding: 20px 16px 110px; display: flex; flex-direction: column; gap: 14px; max-width: 560px; margin: 0 auto; outline: none; }
.loading, .empty { text-align: center; color: var(--muted); padding: 40px 0; font-size: 14px; }

/* glass */
.glass { background: var(--surface); border: 1px solid var(--border); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }
.card { border-radius: 24px; padding: 14px 16px; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.section-title h2 { font-size: 18px; font-weight: 800; margin: 0; }
.section-title a { font-size: 12px; text-decoration: none; }

/* header */
.header { display: flex; align-items: center; justify-content: space-between; height: 44px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; padding: 2px; border: 0; background: linear-gradient(135deg, #A78BFA, #22D3EE); }
.avatar span { width: 100%; height: 100%; border-radius: 50%; background: #1B1145; display: flex; align-items: center; justify-content: center; }
.logo { height: 30px; display: block; }
.pill { height: 36px; padding: 0 12px; border-radius: 18px; display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; }

/* hero slider */
.hero { position: relative; }
.hero-viewport { overflow: hidden; border-radius: 28px; touch-action: pan-y; }
.hero-track { display: flex; transition: transform .5s ease; }
.hero-slide { flex: 0 0 100%; height: 220px; position: relative; overflow: hidden; border-radius: 28px; }
.hero-slide .g1 { position: absolute; top: -70px; inset-inline-start: -60px; width: 240px; height: 240px; border-radius: 50%; }
.hero-slide .g2 { position: absolute; bottom: -90px; inset-inline-end: -40px; width: 220px; height: 220px; border-radius: 50%; }
.hero-slide .ghost { position: absolute; left: -6px; bottom: -14px; direction: ltr; font-size: 104px; font-weight: 800; line-height: 1; white-space: nowrap; color: var(--ghost); letter-spacing: -3px; }
.hero-slide .shine { position: absolute; top: 0; left: 12%; right: 12%; height: 1px; background: linear-gradient(90deg, transparent, rgba(255,255,255,.7), transparent); }
.hero-body { position: relative; height: 100%; padding: 18px; display: flex; flex-direction: column; justify-content: space-between; }
.hero-name { font-size: 40px; font-weight: 800; direction: ltr; text-align: end; line-height: 1.05; letter-spacing: -.5px; }
[dir="ltr"] .hero-name { text-align: start; }
.hero-row { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; gap: 8px; }
.hero-row .sub { font-size: 12px; color: var(--soft); }
.btn-white { border: 0; height: 42px; padding: 0 28px; border-radius: 15px; background: #FFFFFF; color: #1B1145; font-size: 14px; font-weight: 800; box-shadow: 0 8px 24px rgba(255,255,255,.25); }
.dots { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 10px; height: 20px; }
.dot { height: 8px; border-radius: 4px; border: 0; padding: 0; transition: width .3s; }
.arrow { width: 28px; height: 28px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); font-size: 14px; padding: 0; }

/* status chip */
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 500; padding: 4px 10px; border-radius: 12px; align-self: flex-start; white-space: nowrap; }
.chip i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.green { background: rgba(74,222,128,.2); color: #86EFAC; }
.chip.blue { background: rgba(96,165,250,.2); color: #93C5FD; }
.chip.yellow { background: rgba(250,204,21,.2); color: #FDE047; }
.chip.red { background: rgba(248,113,113,.2); color: #FCA5A5; }
.chip.none { background: rgba(255,255,255,.12); color: var(--muted); }
:root[data-theme="light"] .chip.green { color: #15803D; background: rgba(74,222,128,.25); }
:root[data-theme="light"] .chip.blue { color: #1D4ED8; background: rgba(96,165,250,.25); }
:root[data-theme="light"] .chip.yellow { color: #A16207; background: rgba(250,204,21,.3); }
:root[data-theme="light"] .chip.red { color: #B91C1C; background: rgba(248,113,113,.25); }

/* live bar */
.live { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px; border-radius: 17px; background: rgba(74,222,128,.08); border: 1px solid rgba(74,222,128,.22); font-size: 12px; color: #BBF7D0; }
:root[data-theme="light"] .live { color: #166534; }
.live i { width: 8px; height: 8px; border-radius: 50%; background: #4ADE80; animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(74,222,128,.6); } 70% { box-shadow: 0 0 0 8px rgba(74,222,128,0); } 100% { box-shadow: 0 0 0 0 rgba(74,222,128,0); } }

/* games grid */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.game-card { position: relative; overflow: hidden; height: 104px; padding: 12px 14px; border-radius: var(--radius-card); box-shadow: var(--shadow-inset); display: flex; flex-direction: column; justify-content: space-between; text-align: start; border: 1px solid; backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }
.game-card .gl { position: absolute; top: -50px; inset-inline-start: -40px; width: 130px; height: 130px; border-radius: 50%; }
.game-card .nm { position: relative; font-size: 20px; font-weight: 800; direction: ltr; text-align: end; line-height: 1.1; }
[dir="ltr"] .game-card .nm { text-align: start; }
.game-card .meta { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.game-card .price { font-size: 11px; color: var(--soft); }
.badge-sale { font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 8px; background: linear-gradient(135deg, #7C3AED, #D946EF); color: #fff; }

/* active order */
.active-order { display: flex; align-items: center; gap: 14px; min-height: 104px; padding: 14px 16px; border-radius: 24px; }
.ring { position: relative; width: 70px; height: 70px; flex: none; }
.ring .c { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; }
.ring .c b { font-size: 22px; font-weight: 700; }
.ring .c span { font-size: 11px; color: var(--accent-text); }
.active-order .info { flex: 1; min-width: 0; }
.active-order .lbl { font-size: 12px; color: var(--accent-text); }
.active-order .gm { font-size: 15px; font-weight: 700; direction: ltr; text-align: end; }
[dir="ltr"] .active-order .gm { text-align: start; }
.btn-ghost { border: 1px solid var(--border); background: var(--surface-strong); height: 38px; padding: 0 14px; border-radius: 12px; font-size: 13px; font-weight: 500; }

.banner { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 8px 16px; border-radius: 26px; background: linear-gradient(135deg, rgba(124,58,237,.5), rgba(192,38,211,.4)); border: 1px solid rgba(255,255,255,.2); }
:root[data-theme="light"] .banner { color: #fff; }
.banner .t { font-size: 14px; font-weight: 500; flex: 1; }
.banner .s { font-size: 12px; color: #E9E3FF; }

/* tabs: floating bottom bar on mobile, side menu on desktop */
#tabs { position: fixed; left: 16px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); height: 64px; border-radius: 32px; display: flex; align-items: center; justify-content: space-around; background: var(--tabbar); border: 1px solid var(--border); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); z-index: 10; max-width: 560px; margin: 0 auto; }
.tab { display: flex; flex-direction: column; align-items: center; gap: 2px; width: 60px; border: 0; background: none; color: var(--muted); font-size: 11px; padding: 0; }
.tab .ic { display: flex; }
.tab.on { color: var(--text); font-weight: 700; }
.tab.on .ic { margin-top: -30px; width: 50px; height: 50px; border-radius: 50%; background: linear-gradient(135deg, #7C3AED, #C026D3); border: 3px solid var(--bg); align-items: center; justify-content: center; color: #fff; }

@media (min-width: 900px) {
  #layout { display: flex; min-height: 100vh; }
  #tabs { position: sticky; top: 0; left: auto; right: auto; bottom: auto; height: 100vh; width: 220px; flex: none; border-radius: 0; flex-direction: column; justify-content: flex-start; gap: 8px; padding: 28px 14px; margin: 0; border-width: 0; border-inline-end-width: 1px; max-width: none; }
  .tab { flex-direction: row; width: 100%; gap: 12px; font-size: 14px; padding: 10px 14px; border-radius: 14px; justify-content: flex-start; }
  .tab.on { background: linear-gradient(135deg, rgba(124,58,237,.55), rgba(192,38,211,.45)); color: #fff; }
  .tab.on .ic { margin: 0; width: auto; height: auto; border: 0; background: none; }
  #view { max-width: 980px; padding: 28px 32px 40px; flex: 1; }
  .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .hero-slide { height: 260px; }
}

/* generic pieces */
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.col { display: flex; flex-direction: column; gap: 10px; }
.title-xl { font-size: 32px; font-weight: 800; direction: ltr; text-align: end; margin: 0; }
[dir="ltr"] .title-xl { text-align: start; }
.muted { color: var(--muted); font-size: 13px; }
.small { font-size: 12px; }
.btn { border: 0; height: 46px; padding: 0 18px; border-radius: 15px; font-size: 15px; font-weight: 700; background: linear-gradient(135deg, #7C3AED, #C026D3); color: #fff; width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.secondary { background: var(--surface-strong); color: var(--text); border: 1px solid var(--border); }
.plan { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border-radius: 18px; text-align: start; font-size: 15px; }
.plan.sel { outline: 2px solid #A78BFA; }
.plan .p { font-weight: 800; direction: ltr; }
.strike { text-decoration: line-through; color: var(--muted); font-weight: 400; font-size: 12px; margin-inline-end: 6px; }
.field { display: flex; gap: 8px; }
.input { flex: 1; min-width: 0; height: 46px; border-radius: 14px; border: 1px solid var(--border); background: var(--input); color: var(--text); padding: 0 14px; font-size: 15px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; line-height: 1.7; }
.check input { margin-top: 5px; width: 18px; height: 18px; accent-color: #7C3AED; flex: none; }
.kv { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 14px; padding: 6px 0; }
.kv .v { font-weight: 700; }
.copybox { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 14px; background: var(--input); border: 1px solid var(--border); }
.copybox code { flex: 1; font-size: 14px; }
.copybox.big code { font-size: 22px; font-weight: 800; }
.copybtn { border: 1px solid var(--border); background: var(--surface-strong); border-radius: 10px; height: 34px; padding: 0 12px; font-size: 12px; flex: none; }
.qr { display: flex; justify-content: center; }
.qr img { width: 180px; height: 180px; border-radius: 14px; background: #fff; }
.err { color: #FCA5A5; font-size: 13px; }
:root[data-theme="light"] .err { color: #B91C1C; }
.ok { color: #86EFAC; font-size: 13px; }
:root[data-theme="light"] .ok { color: #15803D; }
.notice { border-radius: 18px; padding: 12px 14px; font-size: 13px; line-height: 1.8; }
.notice.warn { background: rgba(250,204,21,.12); border: 1px solid rgba(250,204,21,.3); }
.progress { height: 8px; border-radius: 4px; background: var(--surface-strong); overflow: hidden; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, #7C3AED, #D946EF); }
.list-item { width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 18px; text-align: start; }
.list-item .dotc { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.list-item .grow { flex: 1; min-width: 0; }
.seg { display: flex; gap: 6px; }
.seg button { flex: 1; height: 38px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); font-size: 13px; }
.seg button.on { background: linear-gradient(135deg, #7C3AED, #C026D3); color: #fff; border-color: transparent; }
.pre { white-space: pre-line; line-height: 1.9; font-size: 13px; }
.backbar { display: flex; align-items: center; gap: 8px; }
.backbar button { border: 0; background: none; color: var(--accent-text); font-size: 14px; padding: 4px 0; }
.searchbox { height: 44px; }
#toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); background: rgba(27,17,69,.95); color: #fff; padding: 8px 16px; border-radius: 12px; font-size: 13px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 20; }
#toast.show { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .hero-track { transition: none; } .live i { animation: none; } }
