/* FoMyPay v4 — unified premium mobile design system */
:root {
  --f-bg: #05020b;
  --f-bg-elevated: #090511;
  --f-surface: #10091b;
  --f-surface-raised: #160d25;
  --f-surface-strong: #1b1030;
  --f-border: rgba(190, 145, 255, .18);
  --f-border-strong: rgba(190, 145, 255, .32);
  --f-text: #f8f4ff;
  --f-text-secondary: #c0b7ce;
  --f-text-muted: #8d849b;
  --f-primary: #8f52ff;
  --f-primary-bright: #b879ff;
  --f-primary-deep: #6530d7;
  --f-positive: #63d99a;
  --f-negative: #f06a7d;
  --f-warning: #eac46f;
  --f-radius-sm: 12px;
  --f-radius-md: 16px;
  --f-radius-lg: 20px;
  --f-radius-xl: 24px;
  --f-shadow-card: 0 16px 40px rgba(29, 5, 61, .22);
  --f-shadow-action: 0 12px 32px rgba(126, 55, 235, .32);
  --f-safe: env(safe-area-inset-bottom, 0px);
  --v2-bg: var(--f-bg);
  --v2-card: var(--f-surface);
  --v2-card-2: var(--f-surface-raised);
  --v2-line: var(--f-border);
  --v2-text: var(--f-text);
  --v2-muted: var(--f-text-muted);
  --v2-purple: var(--f-primary);
  --v2-purple-2: var(--f-primary-bright);
  --bg: var(--f-bg);
  --panel: var(--f-surface);
  --panel2: var(--f-surface-raised);
  --line: var(--f-border);
  --text: var(--f-text);
  --muted: var(--f-text-muted);
  --violet: var(--f-primary);
  --violet2: var(--f-primary-bright);
}

html,
body {
  background: var(--f-bg) !important;
  color: var(--f-text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", Inter, system-ui, sans-serif;
  font-size: 16px;
  text-rendering: geometricPrecision;
  -webkit-font-smoothing: antialiased;
}

body { overflow-x: hidden; }
::selection { background: rgba(155, 91, 255, .38); color: var(--f-text); }
button, input, select { -webkit-tap-highlight-color: transparent; }
button { min-height: 44px; }
button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--f-primary-bright);
  outline-offset: 2px;
}

.v2-shell {
  width: min(100%, 480px);
  min-height: 100svh;
  background: var(--f-bg) !important;
  isolation: isolate;
}
.ambient { display: none !important; }
.v2-shell .content {
  padding: 8px 16px calc(116px + var(--f-safe));
}
.v2-shell .immersive-content {
  padding: 8px 16px calc(30px + var(--f-safe));
}
.page-stack { gap: 16px; }
.page-stack > * { min-width: 0; }

/* Top bars */
.v3-topbar {
  min-height: 72px;
  height: auto;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 10px;
  background: rgba(5, 2, 11, .94);
  border-bottom: 1px solid rgba(190, 145, 255, .09);
  backdrop-filter: blur(20px) saturate(1.15);
}
.center-brand,
.game-brand {
  color: var(--f-text);
  font-size: 15px;
  font-weight: 780;
  letter-spacing: -.35px;
  line-height: 1;
}
.center-brand span,
.game-brand span { color: var(--f-primary-bright); }
.round-btn {
  width: 44px !important;
  height: 44px !important;
  min-height: 44px;
  border-radius: 14px !important;
  border: 1px solid var(--f-border);
  background: var(--f-surface);
  color: var(--f-text-secondary);
  box-shadow: inset 0 1px rgba(255, 255, 255, .035);
}
.round-btn svg { width: 19px; height: 19px; }
.deposit-pill,
.wallet-pill {
  min-height: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid var(--f-border-strong);
  background: linear-gradient(145deg, rgba(126, 62, 225, .25), rgba(29, 16, 49, .96));
  box-shadow: 0 10px 28px rgba(86, 27, 173, .25), inset 0 1px rgba(255, 255, 255, .06);
}
.deposit-pill small { font-size: 8px; color: var(--f-text-secondary); }
.deposit-pill b { font-size: 12px; }
.deposit-pill > i { background: var(--f-primary); }

/* Shared surfaces and typography */
.v2-shell .card,
.profile-wide,
.support-list,
.history-card,
.game-panel,
.game-history,
.operators-card,
.referral-users,
.payment-card,
.queue-card,
.rate-panel,
.faq-list details,
.winning-row,
.mines-summary,
.ladder-summary,
.box-odds {
  border: 1px solid var(--f-border);
  background: linear-gradient(145deg, rgba(24, 13, 40, .98), rgba(12, 7, 21, .98));
  box-shadow: inset 0 1px rgba(255, 255, 255, .035), var(--f-shadow-card);
}
.v2-shell .card,
.game-panel,
.game-history,
.box-odds { border-radius: var(--f-radius-lg); padding: 16px; }
.section-head { min-height: 24px; margin-bottom: 12px; }
.section-head h2 { font-size: 15px; line-height: 1.2; letter-spacing: -.25px; }
.page-header {
  min-height: 72px;
  padding: 6px 2px 4px;
  align-items: flex-start;
}
.page-header h1,
.page-title h1 { font-size: 28px; line-height: 1.08; letter-spacing: -1px; }
.page-header p,
.page-title p {
  max-width: 360px;
  margin-top: 7px;
  color: var(--f-text-muted);
  font-size: 11px;
  line-height: 1.45;
}
.text-btn,
.accent-text { color: var(--f-primary-bright); font-size: 10px; }
.muted { color: var(--f-text-muted); font-size: 10px; line-height: 1.5; }

.primary,
.secondary,
.glow-cta {
  min-height: 48px;
  height: 48px;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 760;
  letter-spacing: -.12px;
  transition: transform .18s ease, filter .18s ease, border-color .18s ease, background-color .18s ease;
}
.primary,
.glow-cta,
.profile-wide em,
.wheel-hero-v3 em {
  color: var(--f-text);
  background: linear-gradient(105deg, var(--f-primary-deep), var(--f-primary), var(--f-primary-bright), var(--f-primary));
  background-size: 240% 100%;
  box-shadow: var(--f-shadow-action), inset 0 1px rgba(255, 255, 255, .14);
}
.secondary { background: var(--f-surface-raised); border: 1px solid var(--f-border); }
.primary:not(:disabled):active,
.secondary:not(:disabled):active,
.glow-cta:active { transform: scale(.985); filter: brightness(1.08); }
.primary:disabled { opacity: .42; color: rgba(248, 244, 255, .62); }

/* Navigation */
.bottom-nav {
  bottom: calc(12px + var(--f-safe));
  width: min(calc(100% - 24px), 456px);
  height: 76px;
  padding: 8px;
  border-radius: 22px;
  border: 1px solid var(--f-border);
  background: rgba(13, 7, 23, .96);
  box-shadow: 0 24px 64px rgba(24, 3, 52, .58), inset 0 1px rgba(255, 255, 255, .035);
  backdrop-filter: blur(24px) saturate(1.15);
}
.nav-item { min-height: 58px; gap: 4px; border-radius: 14px; color: #777082; }
.nav-item span { width: 30px; height: 30px; border-radius: 10px; }
.nav-item svg { width: 20px; height: 20px; }
.nav-item small { font-size: 9px; line-height: 1; font-weight: 620; }
.nav-item.active { color: var(--f-text); background: rgba(144, 80, 255, .08); }
.nav-item.active span { color: var(--f-primary-bright); background: transparent; }
.nav-item.nav-exchange { background: transparent; }
.nav-item.nav-exchange span {
  width: 44px;
  height: 44px;
  margin-top: -22px;
  border-radius: 14px;
  background: linear-gradient(145deg, var(--f-primary-bright), var(--f-primary-deep));
  border: 1px solid rgba(255, 255, 255, .15);
  box-shadow: 0 10px 30px rgba(126, 55, 235, .4);
}

/* Home */
.v3-home { gap: 16px; }
.v3-hero {
  height: 248px;
  padding: 20px;
  border-radius: var(--f-radius-xl);
  border-color: var(--f-border-strong);
  background: linear-gradient(145deg, #1a0f2c, #0b0614) !important;
  box-shadow: inset 0 1px rgba(255, 255, 255, .055), 0 20px 52px rgba(47, 10, 92, .3);
}
.v3-hero::before {
  content: "" !important;
  display: block !important;
  position: absolute;
  width: 250px;
  height: 230px;
  right: -30px;
  top: 14px;
  background: radial-gradient(circle, rgba(152, 80, 255, .34), rgba(105, 44, 206, .12) 42%, transparent 70%);
  pointer-events: none;
}
.v3-hero::after { display: none !important; }
.hero-copy { height: 100%; }
.hero-copy > * { max-width: 174px; }
.hero-copy .eyebrow { font-size: 10px; color: var(--f-text-secondary); }
.hero-copy > small { margin-top: 32px; font-size: 11px; color: #b49ccc; }
.hero-copy > strong { margin-top: 3px; font-size: 39px; line-height: 1; letter-spacing: -1.7px; }
.hero-copy > em { margin-top: 7px; font-size: 9px; color: #cbb6ef; }
.hero-copy .primary { width: 160px; height: 46px; min-height: 46px; margin-top: auto; font-size: 12px; }
.hero-robot {
  width: 190px;
  height: 216px;
  right: 4px;
  bottom: -2px;
  object-position: center bottom;
  filter: drop-shadow(0 18px 30px rgba(68, 20, 134, .38));
}
.home-shortcuts { gap: 8px; }
.home-shortcut { min-height: 86px; gap: 8px; color: var(--f-text-secondary); }
.home-shortcut span {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  border: 1px solid var(--f-border);
  background: linear-gradient(145deg, var(--f-surface-strong), var(--f-surface));
  box-shadow: inset 0 1px rgba(255, 255, 255, .045), 0 12px 26px rgba(26, 5, 56, .24);
  color: var(--f-primary-bright);
}
.home-shortcut svg { width: 22px; height: 22px; }
.home-shortcut b { font-size: 10px; line-height: 1.2; font-weight: 650; }
.v3-section > .section-head { margin: 0 2px 10px; }
.profile-wide {
  min-height: 82px;
  padding: 12px;
  grid-template-columns: 50px minmax(0, 1fr) 92px;
  gap: 12px;
  border-radius: var(--f-radius-lg);
}
.profile-wide > .v3-avatar { width: 50px; height: 50px; border-radius: 16px; }
.profile-wide b { font-size: 14px; }
.profile-wide small { margin-top: 4px; font-size: 9px; color: var(--f-text-muted); }
.profile-wide em { width: 92px; height: 40px; border-radius: 12px; font-size: 10px; }
.referral-v3 .ref-main { gap: 10px; margin-bottom: 10px; }
.referral-v3 .ref-main > div {
  min-height: 78px;
  padding: 14px;
  border-radius: var(--f-radius-md);
  background: rgba(139, 77, 239, .075);
  border-color: rgba(190, 145, 255, .13);
}
.ref-main span { font-size: 10px; }
.ref-main b { margin-top: 6px; font-size: 18px; }
.copy-field { height: 44px; border-radius: 13px; background: var(--f-bg-elevated); }
.copy-field code { font-size: 10px; color: var(--f-text-secondary); }
.glow-cta { margin-top: 10px; }
.quick-grid,
.v3-quick { gap: 10px; }
.quick-grid .action-row,
.v3-quick .action-row {
  min-height: 70px;
  padding: 11px;
  border-radius: var(--f-radius-md);
}
.action-row { grid-template-columns: 38px minmax(0, 1fr) 16px; gap: 10px; }
.row-icon { width: 38px; height: 38px; border-radius: 12px; color: var(--f-primary-bright); background: rgba(145, 76, 245, .14); }
.row-icon svg { width: 18px; height: 18px; }
.action-row b { font-size: 11px; line-height: 1.25; }
.action-row small { font-size: 9px; line-height: 1.25; }
.v3-support { padding: 8px; gap: 4px; border-radius: var(--f-radius-lg); }
.v3-support .action-row { min-height: 60px; border: 0 !important; border-bottom: 1px solid rgba(190,145,255,.09) !important; border-radius: 0 !important; background: transparent; }
.v3-support .action-row:last-child { border-bottom: 0 !important; }

/* Exchange, rates, history, profile */
.operators-card { min-height: 76px; padding: 14px; border-radius: var(--f-radius-lg); }
.operators-card b { font-size: 12px; }
.operators-card small { font-size: 9px; }
.operator-faces i { width: 32px; height: 32px; font-size: 9px; border-color: var(--f-surface); }
.segmented { padding: 4px; border-radius: 14px; background: var(--f-bg-elevated); }
.segmented button { height: 40px; border-radius: 10px; font-size: 11px; }
.segmented button.active { background: var(--f-surface-strong); box-shadow: inset 0 1px rgba(255,255,255,.045); }
.field-label,
.calculator label,
.bet-control > label,
.game-panel > .field-label { margin-bottom: 8px; font-size: 10px; color: var(--f-text-secondary); }
.amount-input,
.form-grid input,
.form-grid select,
.text-input,
.two-field input,
.two-field select {
  min-height: 50px;
  border-radius: 14px;
  border-color: var(--f-border);
  background: var(--f-bg-elevated);
}
.amount-input input { font-size: 18px; }
.amount-input span { font-size: 11px; }
.switch-row { min-height: 48px; }
.switch-row b { font-size: 12px; }
.switch-row small { margin-top: 2px; font-size: 9px; line-height: 1.35; }
.requisites { gap: 8px; }
.requisite { height: 62px; padding: 8px 10px; grid-template-columns: 38px minmax(0,1fr) 20px; gap: 10px; border-radius: 15px; }
.requisite b { font-size: 11px; }
.requisite small { font-size: 9px; line-height: 1.25; }
.summary-row { padding: 10px 0; font-size: 10px; }
.summary-total { padding: 16px 0 10px; }
.summary-total span { font-size: 10px; }
.summary-total b { font-size: 23px; }
.agreement span { font-size: 9px; line-height: 1.45; }
.rate-panel { min-height: 148px; padding: 18px; border-radius: var(--f-radius-xl); background: linear-gradient(145deg,#160b28,#090510) !important; }
.rate-panel small { font-size: 10px; }
.rate-panel b { font-size: 39px; }
.history-filters { gap: 8px; padding: 2px 1px 7px; }
.history-filters button { height: 44px; min-height: 44px; padding: 0 15px; border-radius: 12px; font-size: 10px; }
.history-list { gap: 9px; }
.v3-history .history-card,
.history-card {
  min-height: 70px;
  padding: 11px 12px;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 11px;
  border-radius: var(--f-radius-md);
}
.history-icon { width: 42px; height: 42px; border-radius: 13px; }
.history-copy b { font-size: 11px; }
.history-copy > span,
.v3-history .history-copy > span,
.history-copy small { font-size: 9px; }
.history-card > strong { font-size: 11px; text-align: right; }
.status { font-size: 8px; padding: 4px 6px; }
.profile-hero { border-radius: var(--f-radius-xl); }
.tier-card { border-radius: var(--f-radius-md); }
.faq-list details { border-radius: var(--f-radius-md); }

/* Referrals and bonuses */
.referral-hero {
  min-height: 192px !important;
  padding: 24px !important;
  border-radius: var(--f-radius-xl);
  background: linear-gradient(145deg, #180b2d, #090510) !important;
}
.referral-hero::before { background: radial-gradient(ellipse, rgba(157, 78, 255, .44), rgba(103, 42, 200, .13) 44%, transparent 70%); }
.referral-hero > small { font-size: 10px !important; }
.referral-hero > b { font-size: 44px !important; }
.referral-hero > span { font-size: 10px !important; }
.referral-users button { min-height: 64px; height: auto; padding: 10px; border-radius: 15px; }
.referral-users b { font-size: 11px; }
.referral-users small { font-size: 9px; }
.wheel-hero-v3 {
  height: 174px;
  padding: 18px;
  grid-template-columns: minmax(0,1fr) 126px;
  border-radius: var(--f-radius-xl);
  background: linear-gradient(145deg, #190e2f, #090511);
}
.wheel-hero-v3 small { font-size: 8px; }
.wheel-hero-v3 b { font-size: 19px; }
.wheel-hero-v3 span { font-size: 9px; line-height: 1.3; }
.wheel-hero-v3 em { min-height: 38px; height: 38px; border-radius: 12px; font-size: 10px; }
.mini-wheel { box-shadow: 0 0 34px rgba(147, 70, 255, .35); }
.bonus-image-grid { gap: 10px; }
.bonus-image-grid .asset-banner { border-radius: 18px; border-color: var(--f-border); box-shadow: 0 14px 36px rgba(23, 2, 51, .32); }
.bonuses-v3 .bonus-promo { height: 118px; border-radius: var(--f-radius-lg); }
.asset-banner,
.game-banner-list button { transition: transform .2s ease, filter .2s ease; }
.asset-banner:active,
.game-banner-list button:active { transform: scale(.985); filter: brightness(1.06); }

/* Immersive games */
.immersive-page,
.box-detail { gap: 14px; }
.game-topbar { height: 56px; grid-template-columns: 44px minmax(0,1fr) auto; gap: 10px; }
.game-topbar b { font-size: 12px; }
.game-balance { min-height: 42px; height: 42px; border-radius: 13px; padding: 0 12px; font-size: 12px; }
.v3-game-title { min-height: 64px; grid-template-columns: minmax(0,1fr) 44px; padding: 0 2px; }
.v3-game-title h1 { font-size: 25px; letter-spacing: -.8px; }
.v3-game-title p { margin-top: 6px; font-size: 10px; line-height: 1.4; }
.fair-button { width: 44px; height: 44px; border-radius: 14px; color: var(--f-primary-bright); }
.game-panel { padding: 16px; border-radius: var(--f-radius-lg); }
.chips { gap: 8px; margin: 8px 0 12px; }
.chips button { height: 44px; min-height: 44px; border-radius: 12px; font-size: 11px; }
.fair-line { min-height: 42px; padding: 10px; border-radius: 12px; }
.fair-line span,
.fair-line code { font-size: 8px; }
.fair-line b { font-size: 7px; }
.round-history { height: 40px; gap: 7px; }
.round-history span { height: 32px; min-width: 54px; border-radius: 10px; font-size: 9px; }
.game-banner-list { gap: 10px; }
.game-banner-list button { border-radius: var(--f-radius-lg); border: 1px solid var(--f-border); box-shadow: 0 14px 34px rgba(25, 3, 55, .3); }

.space-crash,
.roulette-reel-stage,
.mines-board,
.ladder-board,
.plinko-canvas-wrap,
.pvp-stage,
.case-window,
.wheel-stage-v3 {
  border-radius: var(--f-radius-xl);
  border-color: var(--f-border-strong);
  box-shadow: inset 0 1px rgba(255,255,255,.04), 0 18px 46px rgba(25, 3, 55, .28);
}
.space-crash { height: 338px; }
.crash-center strong { font-size: 48px; }
.crash-center span { font-size: 9px; }
.live-bets-card { padding: 14px; border-radius: var(--f-radius-lg); }
.live-bet { min-height: 56px; padding: 7px 9px; border-radius: 14px; }
.live-bet b { font-size: 10px; }
.live-bet small,
.live-bet > i { font-size: 8px; }
.live-bet > strong { font-size: 10px; }
.roulette-reel-stage { height: 236px; }
.roulette-countdown b { font-size: 34px; }
.roulette-countdown span { font-size: 8px; }
.roulette-group { padding: 10px; border-radius: 16px; }
.roulette-group header b { font-size: 9px; }
.roulette-group header span,
.roulette-group > div small,
.roulette-group > small { font-size: 7px; }
.roulette-group > div b { font-size: 8px; }
.v3-colors button { height: 50px; font-size: 9px; border-radius: 13px; }
.roulette-footer { padding: 14px; border-radius: var(--f-radius-lg); }
.roulette-footer h2 { font-size: 11px; }
.result-dots i { width: 26px; height: 26px; border-radius: 8px; }
.mines-board { gap: 8px; padding: 14px; }
.mine-tile { border-radius: 12px; min-height: 50px; }
.ladder-board { padding: 14px; gap: 6px; }
.ladder-row button { min-height: 44px; height: 44px; font-size: 9px; }
.v3-plinko .plinko-canvas-wrap { height: 382px; }
.v3-plinko .plinko-canvas-wrap canvas { height: 326px; }
.v3-plinko .plinko-payouts span { height: 28px; }
.pvp-stage { min-height: 410px; }
.v3-pvp .pvp-players > div { min-height: 52px; height: 52px; }
.case-window { height: 232px; }
.case-prize { border-radius: 16px; }

/* Sheets, modals and feedback */
.sheet-backdrop,
.result-backdrop { background: rgba(4, 1, 9, .78); backdrop-filter: blur(12px); }
.sheet,
.balance-sheet {
  border-color: var(--f-border-strong);
  background: var(--f-surface);
  box-shadow: 0 -24px 70px rgba(22, 2, 48, .62), inset 0 1px rgba(255,255,255,.05);
}
.result-modal {
  border-color: var(--f-border-strong);
  border-radius: 26px;
  background: linear-gradient(145deg, #1a0e2e, #0c0715);
  box-shadow: 0 30px 90px rgba(24, 2, 54, .72);
}
.result-icon { color: var(--f-primary-bright); background: rgba(146, 79, 246, .15); }
.toast { min-height: 44px; display: grid; place-items: center; border-color: var(--f-border); background: rgba(22, 12, 38, .97); font-size: 10px; }

@media (hover: hover) {
  button:not(:disabled):hover { filter: brightness(1.08); }
  .home-shortcut:hover span,
  .action-row:hover .row-icon { border-color: var(--f-border-strong); color: #d1b7ff; }
}

@media (max-width: 385px) {
  .v2-shell .content { padding-left: 12px; padding-right: 12px; }
  .v2-shell .immersive-content { padding-left: 12px; padding-right: 12px; }
  .page-stack { gap: 14px; }
  .v3-topbar { padding-left: 12px; padding-right: 12px; grid-template-columns: 44px minmax(0,1fr) auto; }
  .center-brand { font-size: 14px; }
  .deposit-pill { grid-template-columns: 26px minmax(0,1fr) 18px; padding: 4px 6px; }
  .deposit-pill > span:first-child { width: 26px; height: 26px; }
  .v3-hero { height: 238px; padding: 18px; }
  .hero-robot { width: 178px; height: 205px; right: 1px; }
  .hero-copy > * { max-width: 158px; }
  .hero-copy > strong { font-size: 36px; }
  .hero-copy .primary { width: 150px; }
  .home-shortcut span { width: 54px; height: 54px; }
  .home-shortcut b { font-size: 9px; }
  .profile-wide { grid-template-columns: 48px minmax(0,1fr) 84px; gap: 10px; }
  .profile-wide em { width: 84px; }
  .bonus-image-grid { gap: 8px; }
  .wheel-hero-v3 { grid-template-columns: minmax(0,1fr) 110px; }
  .mini-wheel { width: 106px; height: 106px; }
  .space-crash { height: 320px; }
}

@media (min-width: 700px) {
  body { padding: 20px 0; }
  .v2-shell { min-height: calc(100svh - 40px); border: 1px solid var(--f-border); border-radius: 32px; box-shadow: 0 34px 110px rgba(20, 2, 45, .62); }
  .bottom-nav { bottom: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  .primary,
  .glow-cta,
  .profile-wide em,
  .wheel-hero-v3 em { animation: none !important; background-position: 50% 50%; }
}
