* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
:root {
  --bg: #f3e8ff; --card: #ffffff; --primary: #7c3aed; --primary-d: #6d28d9;
  --accent: #f59e0b; --green: #10b981; --text: #1f2937; --muted: #9ca3af;
  --shadow: 0 4px 20px rgba(124,58,237,.15);
}
body {
  font-family: -apple-system, "Segoe UI", system-ui, sans-serif;
  background: var(--bg); color: var(--text);
  min-height: 100vh; overscroll-behavior: none;
}
.screen { display: none; min-height: 100vh; }
.screen.active { display: flex; flex-direction: column; }

/* --- Экран входа --- */
#screen-login { align-items: center; justify-content: center;
  background: linear-gradient(160deg, #a78bfa, #7c3aed); padding: 24px; }
.login-card { background: var(--card); border-radius: 28px; padding: 32px 24px;
  width: 100%; max-width: 360px; text-align: center; box-shadow: var(--shadow); }
.login-emoji { font-size: 56px; }
.login-card h1 { font-size: 26px; margin-top: 8px; }
.login-sub { color: var(--muted); margin-bottom: 20px; }
.pin-display { display: flex; gap: 12px; justify-content: center; margin-bottom: 24px; height: 20px; }
.pin-dot { width: 16px; height: 16px; border-radius: 50%; background: #e5e7eb; transition: .2s; }
.pin-dot.filled { background: var(--primary); transform: scale(1.15); }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.pin-key { aspect-ratio: 1; border: none; border-radius: 18px; background: #f3f4f6;
  font-size: 26px; font-weight: 700; color: var(--text); cursor: pointer; transition: .1s; }
.pin-key:active { transform: scale(.92); background: #e5e7eb; }
.pin-key.action { background: transparent; font-size: 20px; }
.login-error { color: #ef4444; min-height: 22px; margin-top: 14px; font-weight: 600; }

/* --- Шапка --- */
.topbar { display: flex; align-items: center; justify-content: space-between;
  padding: 16px; padding-top: max(16px, env(safe-area-inset-top));
  background: var(--card); box-shadow: var(--shadow); border-radius: 0 0 24px 24px; }
.user-chip { display: flex; align-items: center; gap: 10px; }
.avatar-mini { font-size: 36px; }
.user-name { font-weight: 800; font-size: 17px; }
.user-level { font-size: 13px; color: var(--muted); }
.wallet { display: flex; gap: 12px; font-size: 15px; }
.wallet .coin, .wallet .crystal { background: #f3f4f6; padding: 6px 12px; border-radius: 14px; }

/* --- Контент --- */
.content { flex: 1; padding: 16px; padding-bottom: 90px; }
.tab { display: none; } .tab.active { display: block; }
.tab-title { font-size: 22px; margin-bottom: 16px; }

/* --- Задания --- */
.tasks-list { display: flex; flex-direction: column; gap: 12px; }
.task { background: var(--card); border-radius: 20px; padding: 16px;
  display: flex; align-items: center; gap: 14px; box-shadow: var(--shadow); }
.task-icon { font-size: 34px; }
.task-body { flex: 1; }
.task-title { font-weight: 700; font-size: 16px; }
.task-desc { font-size: 13px; color: var(--muted); margin-top: 2px; }
.task-reward { font-size: 13px; color: var(--accent); font-weight: 700; margin-top: 4px; }
.task-btn { border: none; border-radius: 14px; padding: 10px 16px; font-weight: 700;
  font-size: 14px; cursor: pointer; background: var(--primary); color: #fff; }
.task-btn:active { transform: scale(.95); }
.task-btn:disabled { background: #e5e7eb; color: var(--muted); }
.badge { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 10px; }
.badge.submitted { background: #fef3c7; color: #b45309; }
.badge.approved { background: #d1fae5; color: #047857; }
.badge.rejected { background: #fee2e2; color: #b91c1c; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* --- Нижняя навигация --- */
.tabbar { position: fixed; bottom: 0; left: 0; right: 0; display: flex;
  background: var(--card); box-shadow: 0 -4px 20px rgba(0,0,0,.08);
  padding-bottom: env(safe-area-inset-bottom); border-radius: 24px 24px 0 0; }
.tab-btn { flex: 1; border: none; background: none; padding: 12px 0; font-size: 22px;
  color: var(--muted); cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.tab-btn span { font-size: 11px; font-weight: 600; }
.tab-btn.active { color: var(--primary); }

/* --- Toast --- */
.toast { position: fixed; top: 80px; left: 50%; transform: translateX(-50%) translateY(-20px);
  background: var(--green); color: #fff; padding: 14px 22px; border-radius: 16px;
  font-weight: 700; box-shadow: var(--shadow); opacity: 0; pointer-events: none;
  transition: .3s; z-index: 100; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* --- Аватар --- */
.avatar-stage { position: relative; width: 220px; height: 330px; margin: 0 auto 20px;
  background: linear-gradient(180deg, #ddd6fe, #fbcfe8); border-radius: 24px;
  box-shadow: var(--shadow); }
.avatar-stage img { position: absolute; inset: 0; width: 100%; height: 100%; }
.wardrobe-title { font-size: 17px; margin-bottom: 12px; }

/* --- Сетка предметов (гардероб и магазин) --- */
.items-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.item-card { background: var(--card); border-radius: 18px; padding: 12px;
  text-align: center; box-shadow: var(--shadow); }
.item-card.equipped { outline: 3px solid var(--primary); }
.item-img { width: 80px; height: 80px; object-fit: contain; }
.item-name { font-weight: 700; font-size: 14px; margin: 6px 0 2px; }
.item-price { font-size: 13px; color: var(--accent); font-weight: 700; margin-bottom: 8px; }
.item-rarity { font-size: 11px; font-weight: 700; }
.item-rarity.rare { color: #7c3aed; }
.item-rarity.epic { color: #db2777; }
.item-rarity.legendary { color: #d97706; }
.item-btn { border: none; border-radius: 12px; padding: 8px 14px; font-weight: 700;
  font-size: 13px; cursor: pointer; background: var(--primary); color: #fff; width: 100%; }
.item-btn.secondary { background: #ede9fe; color: var(--primary-d); }
.item-btn:disabled { background: #e5e7eb; color: var(--muted); }
.item-btn:active { transform: scale(.96); }
