:root {
  --color-espresso: #2c1810;
  --color-mocha: #4a2f23;
  --color-caramel: #8b5a3c;
  --color-cream: #faf6f1;
  --color-latte: #f0e6da;
  --color-gold: #c9a227;
  --color-gold-soft: rgba(201, 162, 39, 0.15);
  --color-text: #1f1410;
  --color-muted: #6b5b52;
  --color-border: rgba(44, 24, 16, 0.08);
  --color-card: #ffffff;
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body: 'DM Sans', system-ui, sans-serif;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --shadow-sm: 0 1px 3px rgba(44, 24, 16, 0.06);
  --shadow-md: 0 8px 24px rgba(44, 24, 16, 0.1);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --toolbar-h: 148px;
  --color-hero-bg: #f0e8de;
  --color-hero-bg-end: #e5dbd0;
}

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

html {
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-cream);
  min-height: 100dvh;
  overflow-x: hidden;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  background: var(--color-cream);
  position: relative;
}

/* Hero */
.hero {
  position: relative;
  padding: 2.25rem 1.25rem 1.5rem;
  color: var(--color-text);
  overflow: hidden;
}

.hero__bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 90% 70% at 90% 10%, rgba(201, 162, 39, 0.18), transparent 60%),
    radial-gradient(ellipse 70% 50% at 5% 90%, rgba(139, 90, 60, 0.12), transparent 55%),
    linear-gradient(175deg, #faf4ec 0%, var(--color-hero-bg) 45%, var(--color-hero-bg-end) 100%);
  border-bottom: 1px solid var(--color-border);
}

.hero__content {
  position: relative;
  z-index: 1;
}

.hero__eyebrow {
  margin: 0 0 0.35rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--color-caramel);
}

.hero__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 9vw, 3rem);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--color-espresso);
}

.hero__amp {
  color: var(--color-caramel);
  font-style: italic;
}

.hero__subtitle {
  margin: 0.65rem 0 0;
  font-size: 0.9rem;
  color: var(--color-muted);
  max-width: 28ch;
}

.hero__actions {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 2;
}

.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--color-border);
  border-radius: 50%;
  background: var(--color-card);
  color: var(--color-mocha);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
}

.btn-icon:hover {
  box-shadow: var(--shadow-md);
  border-color: rgba(139, 90, 60, 0.3);
}

.btn-icon:active {
  transform: scale(0.94);
}

/* Toolbar */
.toolbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(250, 246, 241, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
  padding: 0.75rem 1rem 0.65rem;
}

.search {
  position: relative;
  display: flex;
  align-items: center;
}

.search__icon {
  position: absolute;
  left: 14px;
  color: var(--color-muted);
  pointer-events: none;
}

.search__input {
  width: 100%;
  padding: 0.75rem 2.5rem 0.75rem 2.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-card);
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--color-text);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search__input:focus {
  outline: none;
  border-color: var(--color-caramel);
  box-shadow: 0 0 0 3px var(--color-gold-soft);
}

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

.search__clear {
  position: absolute;
  right: 8px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: var(--color-latte);
  color: var(--color-mocha);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.categories-wrap {
  position: relative;
  margin-top: 0.85rem;
}

.categories-fade {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 28px;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}

.categories-fade--left {
  left: 0;
  background: linear-gradient(90deg, rgba(250, 246, 241, 0.98), transparent);
}

.categories-fade--right {
  right: 0;
  background: linear-gradient(270deg, rgba(250, 246, 241, 0.98), transparent);
}

.categories-wrap.has-scroll-left .categories-fade--left,
.categories-wrap.has-scroll-right .categories-fade--right {
  opacity: 1;
}

.categories {
  display: flex;
  gap: 0.5rem;
  padding: 0.2rem 0.15rem 0.35rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.categories::-webkit-scrollbar {
  display: none;
}

.category-tab {
  flex: 0 0 auto;
  scroll-snap-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  min-width: 4.5rem;
  padding: 0.55rem 0.65rem 0.5rem;
  border: 1.5px solid transparent;
  border-radius: var(--radius-md);
  background: var(--color-card);
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.category-tab:hover {
  border-color: rgba(139, 90, 60, 0.2);
  transform: translateY(-1px);
}

.category-tab.is-active {
  background: var(--color-espresso);
  border-color: var(--color-espresso);
  box-shadow: 0 4px 14px rgba(44, 24, 16, 0.2);
}

.category-tab__icon {
  font-size: 1.25rem;
  line-height: 1;
}

.category-tab--all .category-tab__icon {
  color: #2563eb;
}

.category-tab--all.is-active .category-tab__icon {
  color: #93c5fd;
}

.category-tab__label {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--color-muted);
  white-space: nowrap;
}

.category-tab.is-active .category-tab__label {
  color: var(--color-cream);
}

.category-tab__count {
  font-size: 0.6rem;
  font-weight: 500;
  color: var(--color-muted);
  opacity: 0.85;
  background: var(--color-latte);
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  min-width: 1.25rem;
  text-align: center;
}

.category-tab.is-active .category-tab__count {
  color: var(--color-espresso);
  background: rgba(255, 255, 255, 0.9);
}

/* Menu sections */
.menu {
  padding: 0 1rem 6rem;
}

.menu__loading,
.menu__error,
.menu__empty {
  padding: 1.5rem 0;
}

.menu__error p,
.menu__empty p {
  text-align: center;
  color: var(--color-muted);
}

.skeleton {
  border-radius: var(--radius-md);
  background: linear-gradient(
    90deg,
    var(--color-latte) 25%,
    #fff 50%,
    var(--color-latte) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
  margin-bottom: 0.75rem;
}

.skeleton--hero { height: 48px; width: 60%; }
.skeleton--chip { height: 36px; width: 100%; border-radius: 999px; }
.skeleton--card { height: 96px; }

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.section {
  scroll-margin-top: calc(var(--toolbar-h) + 12px);
  padding-top: 1.25rem;
}

.section__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}

.section__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 600;
  color: var(--color-espresso);
}

.section__count {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-muted);
}

.product-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.product-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  padding: 0.75rem 0.85rem 0.75rem 0.75rem;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  text-align: left;
  width: 100%;
  font-family: inherit;
  color: inherit;
  transition: box-shadow 0.2s, transform 0.15s, border-color 0.2s;
}

.product-card:active {
  transform: scale(0.985);
}

.product-card:hover {
  border-color: rgba(139, 90, 60, 0.25);
  box-shadow: var(--shadow-md);
}

.product-card__media {
  flex-shrink: 0;
  width: 80px;
  height: 80px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--color-latte);
  box-shadow: inset 0 0 0 1px var(--color-border);
}

.product-card__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.product-card__img.is-placeholder {
  object-fit: contain;
  padding: 0.35rem;
  background: linear-gradient(145deg, #faf6f1 0%, var(--color-latte) 100%);
}

.product-card__body {
  flex: 1;
  min-width: 0;
}

.product-card__name {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.3;
}

.product-card__desc {
  margin: 0.25rem 0 0;
  font-size: 0.8rem;
  color: var(--color-muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 1.15em;
}

.product-card__price {
  flex-shrink: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-caramel);
  white-space: nowrap;
}

.product-card__price small {
  font-size: 0.75rem;
  font-weight: 500;
  opacity: 0.8;
}

/* Buttons */
.btn-primary,
.btn-secondary {
  display: block;
  width: 100%;
  max-width: 280px;
  margin: 1rem auto 0;
  padding: 0.85rem 1.25rem;
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, opacity 0.2s;
}

.btn-primary {
  background: var(--color-espresso);
  color: var(--color-cream);
}

.btn-secondary {
  background: var(--color-latte);
  color: var(--color-espresso);
}

.btn-primary:active,
.btn-secondary:active {
  transform: scale(0.98);
}

/* Footer */
.footer {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  padding: 0.65rem 1rem calc(0.65rem + var(--safe-bottom));
  background: rgba(250, 246, 241, 0.95);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--color-border);
  text-align: center;
  font-size: 0.7rem;
  color: var(--color-muted);
  z-index: 40;
}

.footer p {
  margin: 0.15rem 0;
}

.footer__sync {
  opacity: 0.7;
}

/* Modal */
.modal {
  border: none;
  padding: 0;
  background: transparent;
  max-width: 100%;
  max-height: 100%;
  width: 100%;
  height: 100%;
}

.modal::backdrop {
  background: rgba(31, 20, 16, 0.55);
  backdrop-filter: blur(4px);
}

.modal__panel {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  padding: 1.5rem 1.25rem calc(1.5rem + var(--safe-bottom));
  background: var(--color-card);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: 0 -12px 40px rgba(44, 24, 16, 0.15);
  animation: slideUp 0.3s ease;
}

.modal__panel--product {
  padding-top: 1.25rem;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.modal__close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: var(--color-latte);
  font-size: 1.4rem;
  line-height: 1;
  color: var(--color-mocha);
  cursor: pointer;
}

.modal__title {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--color-espresso);
  padding-right: 2.5rem;
}

.modal__text {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  color: var(--color-muted);
}

.qr-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  padding: 1rem;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
}

.qr-code {
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-code img,
.qr-code canvas,
.qr-code__img {
  display: block;
  border-radius: 8px;
  max-width: 200px;
  height: auto;
}

.qr-wrap__error {
  margin: 0;
  font-size: 0.85rem;
  color: #b45309;
  text-align: center;
}

.modal__actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.modal__actions .btn-primary,
.modal__actions .btn-secondary {
  max-width: none;
  margin: 0;
}

.modal__url {
  font-size: 0.75rem;
  color: var(--color-muted);
  word-break: break-all;
  text-align: center;
  margin: 0 0 1rem;
}

.product-modal__media {
  margin: 0 0 1rem;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--color-latte);
  box-shadow: inset 0 0 0 1px var(--color-border);
  aspect-ratio: 4 / 3;
  max-height: 240px;
}

.product-modal__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.product-modal__img.is-placeholder {
  object-fit: contain;
  padding: 1.5rem;
  background: linear-gradient(160deg, #faf6f1 0%, #f0e6da 55%, #fceef5 100%);
}

.product-modal__category {
  margin: 0 0 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-caramel);
}

.product-modal__desc {
  margin: 0 0 1rem;
  font-size: 0.95rem;
  color: var(--color-muted);
  line-height: 1.55;
}

.product-modal__price {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--color-caramel);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .skeleton { animation: none; }
  .modal__panel { animation: none; }
}
