*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
  overflow-x: clip;
  overscroll-behavior: none;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.4;
  min-height: 100dvh;
  overflow-x: hidden;
  overflow-x: clip;
  overscroll-behavior: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

#app {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100dvh;
  width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  border: none;
  background: none;
  cursor: pointer;
  color: inherit;
}

input,
select,
textarea {
  font-family: inherit;
  font-size: 16px;
}

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.card-surface {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.scroll-x {
  display: flex;
  gap: var(--space-3);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
}

.scroll-x::-webkit-scrollbar {
  display: none;
}

.scroll-x > * {
  scroll-snap-align: start;
  flex-shrink: 0;
}

@keyframes skeleton-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.45;
  }
}

.skeleton {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  animation: skeleton-pulse 1.4s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .skeleton {
    animation: none;
  }
}

.bottom-nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: 430px;
  height: calc(var(--nav-h) + var(--nav-protrude) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--nav-bg);
  display: flex;
  align-items: flex-end;
  z-index: 100;
}

.bottom-nav__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  color: var(--nav-muted);
  min-width: var(--icon-btn);
  min-height: var(--icon-btn);
  padding: var(--space-2) var(--space-1);
}

.bottom-nav__item--active {
  color: var(--brand);
}

.bottom-nav__icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bottom-nav__label {
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.bottom-nav__item--qr {
  color: var(--nav-muted);
}

.bottom-nav__item--qr.bottom-nav__item--active {
  color: var(--nav-muted);
}

.bottom-nav__qr-fab {
  width: 56px;
  height: 56px;
  margin-top: calc(-1 * var(--nav-protrude));
  border-radius: 50%;
  background: var(--brand-strong);
  color: var(--on-brand);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 4px var(--nav-bg);
}

.placeholder-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  padding: max(var(--space-4), env(safe-area-inset-top, 0px)) var(--space-4)
    calc(var(--nav-h) + var(--nav-protrude) + env(safe-area-inset-bottom, 0px) + var(--space-6));
  text-align: center;
  gap: var(--space-4);
}

.placeholder-screen__icon {
  color: var(--muted);
}

.placeholder-screen__title {
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--control-h);
  padding: 0 var(--space-6);
  background: var(--brand-ink);
  color: var(--on-brand);
  border-radius: var(--radius-pill);
  font-size: 15px;
  font-weight: 600;
}

.btn-primary:active {
  background: var(--brand-ink-hover);
}

.error-state {
  padding: var(--space-8) var(--space-4);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  align-items: center;
}

.error-state__text {
  font-size: 15px;
  color: var(--ink);
}

/* Ekranlar orasida yumshoq o'tish */
@keyframes screen-enter {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
#app.screen-enter {
  animation: screen-enter 180ms ease-out both;
}

/* Klaviatura ochiq paytda pastki menyu yashirinadi */
body.kb-open .bottom-nav {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  #app.screen-enter { animation: none; }
}