/* ============ APPLE EMOJI FONT ============ */
@import url('https://fonts.googleapis.com/css2?family=Unbounded:wght@400;600;700;900&family=Nunito:wght@400;500;600;700&display=swap');

* { font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }
.logo, .sec-title, .quick-card-stars, .prod-price, .stat-box-val, .ref-big,
.sheet-title, .sheet-prod-price, .btn-main, .profile-name {
  font-family: 'Unbounded', "Apple Color Emoji", "Segoe UI Emoji", sans-serif !important;
}
body, .input, .btn-secondary, p, span, div {
  font-family: 'Nunito', "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}

/* ============ RESET & VARS ============ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

:root {
  --bg:       #0d0d14;
  --bg2:      #13131e;
  --bg3:      #1a1a28;
  --border:   rgba(255,255,255,0.07);
  --gold:     #f5c842;
  --gold2:    #e8a020;
  --purple:   #8b5cf6;
  --blue:     #38bdf8;
  --green:    #34d399;
  --red:      #f87171;
  --text:     #f0f0fa;
  --muted:    #6b6b8a;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
}

html, body { height: 100%; overflow: hidden; background: var(--bg); color: var(--text); }

body::after {
  content: '';
  position: fixed; inset: 0; pointer-events: none; z-index: 9999;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
  opacity: 0.4;
}

/* ============ APP SHELL ============ */
#app {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bot);
  overflow: hidden;
}

/* ============ HEADER ============ */
.header {
  padding: 14px 20px 12px;
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--bg) 0%, transparent 100%);
  position: relative; z-index: 10;
}
.logo {
  font-size: 18px; font-weight: 900;
  background: linear-gradient(90deg, var(--gold), var(--gold2));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  letter-spacing: -0.5px;
}
.header-bal {
  display: flex; align-items: center; gap: 6px;
  background: rgba(245,200,66,0.1);
  border: 1px solid rgba(245,200,66,0.2);
  padding: 6px 12px; border-radius: 20px;
  font-size: 13px; font-weight: 700; color: var(--gold);
}

/* ============ SCROLL ============ */
.scroll { flex: 1; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.scroll::-webkit-scrollbar { display: none; }

/* ============ PAGES ============ */
.page { display: none; padding: 0 16px 100px; animation: fadeUp 0.3s ease; }
.page.active { display: block; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

/* ============ NAV ============ */
.nav {
  position: relative; z-index: 10; display: flex;
  background: var(--bg2); border-top: 1px solid var(--border);
  padding: 8px 0 calc(8px + var(--safe-bot)); flex-shrink: 0;
}
.nav-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: none; border: none; cursor: pointer; padding: 6px 0; transition: all 0.2s;
}
.nav-icon { font-size: 22px; transition: transform 0.2s; }
.nav-label { font-size: 10px; color: var(--muted); font-weight: 600; letter-spacing: 0.3px; transition: color 0.2s; }
.nav-btn.active .nav-icon { transform: scale(1.15); }
.nav-btn.active .nav-label { color: var(--gold); }

/* ============ HERO ============ */
.hero {
  margin: 0 0 20px;
  background: linear-gradient(135deg, #1a1228 0%, #0d1a2a 50%, #1a1a0d 100%);
  border-radius: 20px; border: 1px solid var(--border);
  padding: 28px 24px; position: relative; overflow: hidden;
}
.hero::before {
  content: ''; position: absolute; top: -40px; right: -40px;
  width: 180px; height: 180px; border-radius: 50%;
  background: radial-gradient(circle, rgba(245,200,66,0.15) 0%, transparent 70%);
}
.hero::after {
  content: ''; position: absolute; bottom: -30px; left: -20px;
  width: 120px; height: 120px; border-radius: 50%;
  background: radial-gradient(circle, rgba(139,92,246,0.12) 0%, transparent 70%);
}
.hero-tag {
  font-size: 11px; font-weight: 700; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--gold);
  background: rgba(245,200,66,0.1);
  display: inline-block; padding: 3px 10px; border-radius: 6px; margin-bottom: 10px;
}
.hero h1 {
  font-size: 22px; font-weight: 900; line-height: 1.2; margin-bottom: 8px;
  background: linear-gradient(135deg, #fff 0%, var(--gold) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.hero p { font-size: 13px; color: var(--muted); line-height: 1.6; }

/* ============ SECTION TITLE ============ */
.sec-title {
  font-size: 13px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: 1px;
  margin: 24px 0 12px; display: flex; align-items: center; gap: 8px;
}
.sec-title::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ============ QUICK CARDS ============ */
.quick-row {
  display: flex; gap: 10px; overflow-x: auto; overflow-y: hidden;
  scrollbar-width: none; margin: 0 -16px; padding: 4px 16px 8px;
}
.quick-row::-webkit-scrollbar { display: none; }
.quick-card {
  flex-shrink: 0; background: var(--bg2); border: 1px solid var(--border);
  border-radius: 14px; padding: 14px 16px; min-width: 100px;
  text-align: center; cursor: pointer; transition: all 0.2s;
}
.quick-card:active { transform: scale(0.95); }
.quick-card.active-sel { border-color: var(--gold); background: rgba(245,200,66,0.06); }
.quick-card-ico { font-size: 24px; margin-bottom: 6px; }
.quick-card-stars { font-size: 15px; font-weight: 700; color: var(--text); }
.quick-card-price { font-size: 12px; color: var(--gold); font-weight: 700; margin-top: 2px; }

/* ============ PRODUCT CARDS ============ */
.prod-list { display: flex; flex-direction: column; gap: 10px; }
.prod-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 16px; padding: 16px;
  display: flex; align-items: center; gap: 14px;
  cursor: pointer; transition: all 0.2s; position: relative; overflow: hidden;
}
.prod-card:active { transform: scale(0.98); }
.prod-emoji {
  width: 52px; height: 52px; border-radius: 14px; background: var(--bg3);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; flex-shrink: 0;
}
.prod-info { flex: 1; }
.prod-name { font-size: 14px; font-weight: 700; margin-bottom: 3px; }
.prod-desc { font-size: 12px; color: var(--muted); line-height: 1.4; }
.prod-price { font-size: 15px; font-weight: 700; color: var(--gold); text-align: right; flex-shrink: 0; }

/* ============ WIP BANNER ============ */
.wip-banner {
  background: linear-gradient(135deg, #1a1228, #0d1428);
  border: 1px solid rgba(139,92,246,0.3);
  border-radius: 20px; padding: 40px 24px;
  text-align: center; margin-top: 16px;
}
.wip-icon { font-size: 56px; margin-bottom: 16px; }
.wip-title { font-size: 18px; font-weight: 700; margin-bottom: 8px; color: var(--text); }
.wip-desc { font-size: 13px; color: var(--muted); line-height: 1.6; }
.wip-badge {
  display: inline-block; margin-top: 16px;
  background: rgba(139,92,246,0.15); color: var(--purple);
  border: 1px solid rgba(139,92,246,0.3);
  padding: 6px 16px; border-radius: 20px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.5px;
}

/* ============ CAT TABS ============ */
.cat-tabs {
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  margin: 0 -16px; padding: 2px 16px 8px;
}
.cat-tabs::-webkit-scrollbar { display: none; }
.cat-tab {
  flex-shrink: 0; padding: 7px 16px; border-radius: 20px;
  font-size: 13px; font-weight: 600;
  border: 1px solid var(--border); background: var(--bg2); color: var(--muted);
  cursor: pointer; transition: all 0.2s;
}
.cat-tab.active { background: var(--gold); color: #000; border-color: var(--gold); }

/* ============ PROFILE ============ */
.profile-hero {
  background: linear-gradient(135deg, #1a1228, #0d1428);
  border: 1px solid var(--border); border-radius: 20px;
  padding: 24px; text-align: center; margin-bottom: 16px;
  position: relative; overflow: hidden;
}
.profile-hero::before {
  content: ''; position: absolute; top: -50%; left: 50%; transform: translateX(-50%);
  width: 200px; height: 200px; border-radius: 50%;
  background: radial-gradient(circle, rgba(245,200,66,0.08) 0%, transparent 70%);
}
.profile-avatar {
  width: 72px; height: 72px; border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold2));
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; margin: 0 auto 12px;
  box-shadow: 0 0 0 3px rgba(245,200,66,0.2);
}
.profile-name { font-size: 17px; font-weight: 700; margin-bottom: 4px; }
.profile-id { font-size: 12px; color: var(--muted); font-family: monospace; }
.stats-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.stat-box {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 14px; padding: 14px 10px; text-align: center;
}
.stat-box-val { font-size: 18px; font-weight: 700; color: var(--gold); }
.stat-box-lbl { font-size: 10px; color: var(--muted); margin-top: 4px; font-weight: 600; text-transform: uppercase; }

/* ============ ORDERS ============ */
.order-item {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 14px; padding: 14px 16px;
  display: flex; align-items: center; gap: 12px; margin-bottom: 8px;
}
.order-ico {
  width: 40px; height: 40px; border-radius: 12px; background: var(--bg3);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.order-info { flex: 1; }
.order-name { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.order-date { font-size: 11px; color: var(--muted); }
.order-right { text-align: right; }
.order-price { font-size: 14px; font-weight: 700; color: var(--gold); margin-bottom: 4px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 10px; font-weight: 700; text-transform: uppercase; }
.badge.completed { background: rgba(52,211,153,0.12); color: var(--green); }
.badge.paid      { background: rgba(245,200,66,0.12); color: var(--gold); }
.badge.wait      { background: rgba(56,189,248,0.12); color: var(--blue); }
.badge.cancelled { background: rgba(248,113,113,0.1); color: var(--red); }

/* ============ REF ============ */
.ref-card {
  background: linear-gradient(135deg, #1a1228, #0a1520);
  border: 1px solid var(--border); border-radius: 20px;
  padding: 24px; margin-bottom: 16px; text-align: center;
}
.ref-big { font-size: 36px; font-weight: 900; color: var(--gold); margin-bottom: 4px; }
.ref-label { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.ref-link-box {
  background: var(--bg3); border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 16px; font-size: 12px; font-family: monospace;
  color: var(--blue); word-break: break-all; text-align: center; margin: 12px 0;
}
.ref-how { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.ref-step {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 16px; display: flex; align-items: center; gap: 12px;
}
.ref-step-num {
  width: 28px; height: 28px; border-radius: 50%;
  background: rgba(245,200,66,0.12); color: var(--gold);
  font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.ref-step-text { font-size: 13px; color: var(--muted); line-height: 1.4; }

/* ============ SHEET ============ */
.sheet-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  z-index: 100; display: none; backdrop-filter: blur(4px);
}
.sheet-overlay.open { display: block; animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.sheet {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: var(--bg2); border-radius: 24px 24px 0 0;
  border-top: 1px solid var(--border);
  padding: 0 20px calc(20px + var(--safe-bot));
  max-height: 90vh; overflow-y: auto;
  animation: slideUp 0.3s cubic-bezier(0.32,0.72,0,1);
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet-handle { width: 36px; height: 4px; border-radius: 2px; background: var(--border); margin: 12px auto 20px; }
.sheet-title { font-size: 18px; font-weight: 700; margin-bottom: 20px; }
.sheet-product {
  background: var(--bg3); border-radius: 16px; padding: 16px;
  display: flex; align-items: center; gap: 14px; margin-bottom: 20px;
}
.sheet-prod-ico {
  width: 56px; height: 56px; border-radius: 14px; background: var(--bg);
  display: flex; align-items: center; justify-content: center; font-size: 28px;
}
.sheet-prod-name { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.sheet-prod-price { font-size: 20px; font-weight: 700; color: var(--gold); }
.input-label { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }
.input {
  width: 100%; background: var(--bg3); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px 16px; font-size: 15px;
  color: var(--text); outline: none; transition: border-color 0.2s; margin-bottom: 16px;
}
.input:focus { border-color: var(--gold); }
.input::placeholder { color: var(--muted); }
.payment-box {
  background: rgba(245,200,66,0.05); border: 1px solid rgba(245,200,66,0.2);
  border-radius: 14px; padding: 16px; margin-bottom: 20px;
}
.payment-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.payment-row:last-child { margin-bottom: 0; }
.payment-key { font-size: 13px; color: var(--muted); }
.payment-val { font-size: 13px; font-weight: 700; color: var(--text); }
.payment-card {
  font-size: 17px; font-weight: 700; font-family: monospace;
  color: var(--gold); letter-spacing: 2px; text-align: center;
  margin: 8px 0; padding: 8px; background: var(--bg3); border-radius: 10px;
  cursor: pointer;
}
.btn-main {
  width: 100%; padding: 16px;
  background: linear-gradient(135deg, var(--gold), var(--gold2));
  border: none; border-radius: 16px; font-size: 16px; font-weight: 700;
  color: #000; cursor: pointer; transition: all 0.2s; margin-top: 4px;
}
.btn-main:active { transform: scale(0.97); opacity: 0.9; }
.btn-secondary {
  width: 100%; padding: 14px; background: var(--bg3);
  border: 1px solid var(--border); border-radius: 16px;
  font-size: 14px; font-weight: 600; color: var(--muted);
  cursor: pointer; transition: all 0.2s; margin-top: 8px;
}
.recipient-need { display: none; }
.recipient-need.show { display: block; }

/* ============ CUSTOM STARS ============ */
.custom-row { display: flex; gap: 8px; margin-top: 12px; margin-bottom: 16px; }
.custom-row .input { margin-bottom: 0; flex: 1; }
.btn-calc {
  background: rgba(245,200,66,0.15); border: 1px solid rgba(245,200,66,0.3);
  border-radius: 12px; padding: 0 16px; color: var(--gold);
  font-size: 13px; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.calc-result { font-size: 13px; color: var(--muted); margin-bottom: 16px; text-align: center; }
.calc-result span { color: var(--gold); font-weight: 700; }

/* ============ MISC ============ */
.toast {
  position: fixed; top: calc(20px + var(--safe-top));
  left: 50%; transform: translateX(-50%);
  background: var(--green); color: #000;
  padding: 12px 24px; border-radius: 40px;
  font-size: 14px; font-weight: 700; z-index: 999; white-space: nowrap;
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards; pointer-events: none;
}
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(-10px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; } }
.loader { display: flex; align-items: center; justify-content: center; padding: 40px; color: var(--muted); font-size: 24px; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty-state .empty-ico { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* ============ RESPONSIVE ============ */
@media (max-width: 360px) {
  .hero h1 { font-size: 18px; }
  .quick-card { min-width: 85px; padding: 10px 12px; }
  .stat-box-val { font-size: 15px; }
  .ref-big { font-size: 28px; }
}
@media (min-width: 768px) {
  #app { max-width: 480px; margin: 0 auto; }
  .hero h1 { font-size: 26px; }
}
