/* ============ Portals клон «Мои подарки» ============ */
:root {
  --bg: #0e0e11;
  --card: #1c1c1e;
  --card-2: #26262b;
  --stroke: rgba(255,255,255,.06);
  --text: #ffffff;
  --text-2: #8e8e93;
  --blue: #3390ec;
  --green: #3ddc84;
  --nav-h: 60px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { margin:0; padding:0; box-sizing:border-box; -webkit-tap-highlight-color:transparent; }
html, body { height:100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  font-size: 15px; line-height: 1.3;
  overscroll-behavior: none;
  user-select: none;
}
button { font-family: inherit; border:none; background:none; color:inherit; cursor:pointer; }
img, svg { display:block; }

/* ============ Splash ============ */
.app-splash-screen {
  position: fixed; inset: 0; z-index: 100;
  background: var(--bg);
  transition: opacity .35s ease, visibility .35s;
}
.app-splash-screen.splash-hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.splash-hero-art { width:100%; height:100%; }
.splash-art-img { width: 100%; height: 100%; object-fit: cover; }
.splash-footer-loader { position:absolute; left:0; right:0; bottom:calc(24px + var(--safe-b)); padding: 0 32px; }
.splash-progress-track { height:4px; border-radius:2px; background:rgba(255,255,255,.12); overflow:hidden; }
.splash-progress-fill { height:100%; width:0%; border-radius:2px; background:var(--blue); transition:width .25s ease; }

/* ============ Frame ============ */
.app {
  max-width: 480px; margin: 0 auto; min-height: 100vh;
  padding: 0 0 calc(var(--safe-b) + 24px);
}

/* ============ TMA bar ============ */
.tma-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + var(--safe-t)) 12px 6px;
}
.tma-side { display: flex; align-items: center; gap: 6px; color: var(--text-2); }
.tma-side-text { font-size: 15px; }
.tma-x, .tma-round {
  width: 32px; height: 32px; border-radius: 999px;
  background: var(--card-2);
  display: flex; align-items: center; justify-content: center;
}
.tma-x svg, .tma-round svg { width: 16px; height: 16px; }

/* ============ Balances ============ */
.balance-row { display: flex; justify-content: space-between; padding: 8px 12px; }
.balance-chip {
  display: flex; align-items: center; gap: 5px;
  background: var(--card-2); border-radius: 999px;
  padding: 5px 11px; font-size: 13px; font-weight: 600;
}
.balance-chip .star-ico { width: 14px; height: 14px; }
.balance-chip .gem-ico { width: 13px; height: 13px; }

/* ============ Tabs ============ */
.tabs-row { display: flex; align-items: baseline; gap: 18px; padding: 10px 14px 8px; }
.tab { font-size: 20px; font-weight: 700; color: var(--text-2); }
.tab.active { font-size: 24px; font-weight: 800; color: var(--text); }

/* ============ Subtabs ============ */
.subtabs-row { display: flex; gap: 8px; padding: 0 14px 14px; }
.subtab {
  font-size: 13px; font-weight: 600; color: var(--text-2);
  background: var(--card); border-radius: 999px; padding: 7px 13px;
}
.subtab.active { background: #fff; color: #000; font-weight: 700; }

/* ============ Actions ============ */
.actions-row { display: flex; justify-content: space-between; padding: 0 10px 14px; }
.action {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  width: 64px; color: var(--text);
}
.action:active .action-ico { transform: scale(.92); }
.action-ico {
  width: 40px; height: 40px; border-radius: 999px;
  background: var(--card-2);
  display: flex; align-items: center; justify-content: center;
  transition: transform .12s;
}
.action-ico svg { width: 20px; height: 20px; }
.action-label { font-size: 11px; color: var(--text-2); }

/* ============ Search ============ */
.search-row { display: flex; gap: 8px; padding: 0 14px 10px; }
.search-field {
  flex: 1; display: flex; align-items: center; gap: 8px;
  background: var(--card); border-radius: 14px;
  padding: 11px 13px; color: var(--text-2); font-size: 14px;
}
.search-field svg { width: 16px; height: 16px; }
.search-toggle {
  width: 40px; height: 40px; border-radius: 14px;
  background: var(--card-2);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2);
}
.search-toggle svg { width: 16px; height: 16px; }

/* ============ Filters ============ */
.filters-row { display: flex; gap: 8px; align-items: center; padding: 0 14px 16px; }
.filter-btn {
  position: relative;
  width: 34px; height: 34px; border-radius: 999px;
  background: var(--card-2); color: var(--text);
  display: flex; align-items: center; justify-content: center;
}
.filter-btn svg { width: 15px; height: 15px; }
.filter-btn.has-badge .badge {
  position: absolute; top: -4px; right: -4px;
  width: 15px; height: 15px; border-radius: 999px;
  background: var(--blue); color: #fff;
  font-size: 9px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.filter-clear { background: rgba(51,144,236,.25); }
.filter-pill {
  display: flex; align-items: center; gap: 6px;
  background: var(--card); border-radius: 999px;
  padding: 8px 12px; font-size: 13px; font-weight: 600;
}
.filter-pill svg { width: 12px; height: 12px; }
.pill-count {
  width: 16px; height: 16px; border-radius: 999px;
  background: #7a7a80; color: #fff;
  font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* ============ Одна страница: пустое состояние ============ */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  padding: 8px 28px 0;
}
.empty-pepe { width: 224px; height: auto; }
.empty-title { font-size: 20px; font-weight: 800; text-align: center; margin-top: 6px; }
.empty-sub { font-size: 14px; color: var(--text-2); text-align: center; margin-top: 6px; }
.empty-hint {
  font-size: 12px; color: var(--text-2);
  text-align: center; line-height: 1.45;
  margin-top: 10px;
  opacity: .8;
}

/* ============ Buttons ============ */
.btn-white {
  width: 100%;
  margin-top: 12px;
  background: #fff; color: #000;
  font-size: 15px; font-weight: 700;
  text-align: center;
  border-radius: 14px;
  padding: 14px 0;
}
.btn-white:active { opacity: .88; }
.btn-blue {
  width: 100%;
  margin-top: 12px;
  background: var(--blue); color: #fff;
  font-size: 15px; font-weight: 700;
  text-align: center;
  border-radius: 14px;
  padding: 14px 0;
}
.btn-blue:active { background: #2b7fd4; }

/* ============ Loading state (connected) ============ */
.connected-box {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 56px 28px 24px; text-align: center;
}
.spinner {
  width: 36px; height: 36px; border-radius: 999px;
  border: 3px solid var(--card-2);
  border-top-color: var(--blue);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.connected-title { font-size: 18px; font-weight: 700; }
.connected-sub { font-size: 14px; color: var(--text-2); }

/* ============ Шторка-меню (1:1 из скрина LO) ============ */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(0,0,0,.55);
  display: flex; align-items: flex-end;
  opacity: 0; visibility: hidden;
  transition: opacity .25s ease, visibility .25s;
}
.sheet-backdrop.open { opacity: 1; visibility: visible; }
.sheet {
  width: 100%;
  background: var(--card);
  border-radius: 20px 20px 0 0;
  padding: 10px 14px calc(18px + var(--safe-b));
  max-height: 76%;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(.32,.72,.35,1);
}
.sheet-backdrop.open .sheet { transform: translateY(0); }
.sheet-grab {
  width: 36px; height: 4px; border-radius: 2px;
  background: rgba(255,255,255,.18);
  margin: 2px auto 12px;
}
.sheet-item {
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  padding: 12px 4px;
  background: none; border: none;
  color: var(--text); font-size: 15px;
  cursor: pointer; text-align: left;
}
.sheet-item:active { opacity: .7; }
.sheet-ico {
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--card-2);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sheet-ico svg { width: 18px; height: 18px; }
.sheet-stats { display: flex; gap: 8px; margin-top: 10px; }
.sheet-stat {
  flex: 1;
  background: var(--card-2);
  border-radius: 14px;
  padding: 10px 8px;
  text-align: center;
}
.sheet-stat-n { font-size: 18px; font-weight: 800; }
.sheet-stat-t { font-size: 11px; color: var(--text-2); margin-top: 3px; line-height: 1.25; }

/* ============ Toast ============ */
.toast-notice {
  position: fixed;
  left: 50%; bottom: 28px;
  transform: translateX(-50%) translateY(16px);
  background: var(--card-2);
  color: var(--text);
  font-size: 14px; font-weight: 500;
  padding: 12px 18px;
  border-radius: 14px;
  opacity: 0; visibility: hidden;
  transition: all .25s ease;
  z-index: 90;
  max-width: calc(100vw - 48px);
  text-align: center;
}
.toast-notice.show { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }
