/* === BASE STYLES === */

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  background-color: #050505;
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  line-height: 1.5;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* App container — centered, max 480px */
#app {
  position: relative;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  background-color: var(--bg-primary);
  overflow-x: hidden; /* не clip по вертикали, иначе блики не видны */
}

/* Scrollable content area */
.scroll-container {
  flex: 1;
  height: 0; /* required for flex child to scroll properly */
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.scroll-container::-webkit-scrollbar { display: none; }

/* Fade overlay — карточки исчезают под хедером */
#library-scroll::before {
  content: '';
  display: block;
  position: sticky;
  top: 0;
  height: 56px;
  margin-bottom: -56px;
  background: linear-gradient(to bottom, var(--bg-primary) 0%, transparent 100%);
  pointer-events: none;
  z-index: 10;
}

/* Отступ снизу чтобы последняя карточка не уходила под BottomBar */
#products-list {
  padding-bottom: calc(80px + var(--safe-bottom));
}

/* Отступ снизу в профиле */
#page-profile .scroll-container > *:last-child {
  margin-bottom: 80px;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Nunito', 'Inter', sans-serif;
  font-weight: 800;
  line-height: 1.2;
}

code, pre, .mono {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
}

/* Links */
a {
  color: var(--color-orange-primary);
  text-decoration: none;
}

/* Buttons reset */
button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible {
  outline: 2px solid var(--color-orange-primary);
  outline-offset: 2px;
}

/* Input reset */
input {
  font-family: 'Inter', sans-serif;
  border: none;
  outline: none;
  background: none;
  color: inherit;
}

input::placeholder {
  color: var(--text-muted);
}

/* Image */
img {
  display: block;
  max-width: 100%;
}

/* Utility classes */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.w-full { width: 100%; }

.text-orange { color: var(--color-orange-primary); }
.text-orange-bright { color: var(--color-orange-bright); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }

.nunito { font-family: 'Nunito', sans-serif; }
.font-bold { font-weight: 700; }
.font-extrabold { font-weight: 800; }

.hidden { display: none !important; }
.invisible { visibility: hidden; }
.opacity-0 { opacity: 0; }

/* Canvas background layers */
#canvas-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

/* Main app layer above canvas */
#app {
  position: relative;
  z-index: 1;
}

/* Divider */
.divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 4px 0;
}

/* Section title */
.section-title {
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 15px;
  color: var(--color-orange-primary);
  margin-bottom: 12px;
}

/* Toast container */
#toast-container {
  position: fixed;
  bottom: calc(80px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
  width: 90%;
  max-width: 420px;
}
