:root {
  --navy: #0d1928;
  --deep: #081321;
  --paper: #f8f6f1;
  --white: #ffffff;
  --ink: #1b2430;
  --muted: #526173;
  --line: #d9d5ca;
  --gold: #b08a3e;
  --gold-text: #7d5f22;
  --serif: "Playfair Display", Georgia, serif;
  --sans: Inter, system-ui, sans-serif;
  --my: "Noto Sans Myanmar", Inter, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.7 var(--sans); padding-bottom: 72px; }
html[lang="my"] body { font-family: var(--my); line-height: 1.8; letter-spacing: 0; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
[hidden] { display: none !important; }

.top-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px max(16px, calc((100vw - 1200px) / 2));
  background: var(--navy); color: #f3f2ec; border-bottom: 1px solid #23364b;
}
.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand strong { display: block; font: 600 20px/1.1 var(--serif); }
.brand small { display: block; font-size: 10px; letter-spacing: 0.16em; color: #d8be80; margin-top: 2px; }
.top-nav { display: flex; gap: 20px; font-size: 13px; color: #c7d1dc; }
.top-nav a:hover { color: #d8be80; }

.lang-switch { display: inline-flex; border: 1px solid #395066; border-radius: 4px; overflow: hidden; background: var(--deep); }
.lang-btn { border: 0; background: transparent; color: #b6c1cd; padding: 6px 12px; min-height: 36px; font-size: 12px; cursor: pointer; }
.lang-btn.active { background: #d8be80; color: var(--deep); font-weight: 600; }

.container { max-width: 1200px; margin: 0 auto; padding: 24px 16px 48px; }
.card { background: var(--white); border: 1px solid var(--line); border-radius: 8px; padding: 24px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px; border-radius: 6px; border: 1px solid transparent; font-size: 14px; font-weight: 600; cursor: pointer; }
.btn-primary { background: var(--navy); color: var(--white); }
.btn-primary:hover { background: #172b42; }
.btn-dark { background: #263547; color: var(--white); }
.btn-outline { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-full { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-link { background: transparent; border: 0; color: #d8be80; font-size: 12px; cursor: pointer; text-decoration: underline; }

.badge { display: inline-flex; align-items: center; padding: 5px 10px; border-radius: 6px; font-size: 12px; line-height: 1.5; font-weight: 600; background: #eef1f5; color: var(--navy); width: fit-content; }
.badge-gold { background: #f6eedc; color: var(--gold-text); border: 1px solid #e3cf9f; }

.stores-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 20px; }

.store-hero { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; margin-bottom: 24px; }
.store-badge-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.store-hero h1 { margin: 0 0 8px; font-size: clamp(24px, 3.2vw, 36px); }
.order-channels { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.channel-chip { display: inline-flex; align-items: center; padding: 6px 12px; border-radius: 6px; font-size: 13px; background: var(--paper); border: 1px solid var(--line); color: var(--navy); font-weight: 500; }
.channel-chip:hover:not(.channel-static) { border-color: var(--gold); }

.search-bar { display: flex; gap: 8px; margin-bottom: 24px; }
.search-bar input { flex: 1; min-height: 44px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 6px; background: var(--white); }

.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 20px; }
.book-card { background: var(--white); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; display: flex; flex-direction: column; }
.book-cover-wrap { display: block; aspect-ratio: 2 / 3; background: #ece8de; overflow: hidden; }
.book-cover-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover-placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; padding: 16px; text-align: center; font-weight: 600; color: var(--muted); }
.book-card-body { padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.book-card-body h3 { margin: 0; font-size: 15px; line-height: 1.45; }
.price-tag { margin: 4px 0 0; font-weight: 700; color: var(--gold-text); font-size: 14px; }
.empty-msg { text-align: center; padding: 32px; color: var(--muted); }

/* Chat Drawer */
.chat-drawer {
  position: fixed; right: 16px; bottom: 16px; width: min(400px, calc(100vw - 24px)); height: min(560px, calc(100vh - 96px));
  background: var(--white); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 18px 48px rgba(8, 19, 33, 0.24);
  display: flex; flex-direction: column; z-index: 50; overflow: hidden;
}
.chat-header { background: var(--navy); color: var(--white); padding: 14px 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.chat-header small { display: block; color: #d8be80; font-size: 12px; margin-top: 2px; }
.chat-header-actions { display: flex; align-items: center; gap: 10px; }
.icon-close { background: transparent; border: 0; color: var(--white); font-size: 18px; cursor: pointer; padding: 4px 8px; }
.chat-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; background: var(--paper); }
.chat-msg { max-width: 86%; padding: 10px 14px; border-radius: 10px; font-size: 14px; white-space: pre-wrap; word-break: break-word; }
.chat-msg-buyer { align-self: flex-end; background: var(--navy); color: var(--white); }
.chat-msg-ai { align-self: flex-start; background: var(--white); border: 1px solid #d8be80; color: var(--ink); }
.chat-msg-seller { align-self: flex-start; background: #e8f3ee; border: 1px solid #a8d2bf; color: var(--ink); }
.chat-msg-system { align-self: center; font-size: 12px; color: var(--muted); background: transparent; padding: 4px; text-align: center; }
.chat-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); background: var(--white); }
.chat-form input { flex: 1; min-height: 44px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 6px; }

.mobile-sticky-bar { display: none; }
@media (max-width: 720px) {
  .store-hero { flex-direction: column; }
  .store-hero-actions { width: 100%; }
  .store-hero-actions .btn { width: 100%; }
  .mobile-sticky-bar { display: block; position: fixed; left: 0; right: 0; bottom: 0; padding: 10px 16px; background: var(--white); border-top: 1px solid var(--line); z-index: 40; }
  .chat-drawer { right: 8px; left: 8px; bottom: 8px; width: auto; height: calc(100vh - 24px); }
}

/* Shop logo badges (Storefront hero & Home directory cards) */
.store-identity-row, .store-card-header { display: flex; align-items: center; gap: 14px; }
.store-logo { width: 64px; height: 64px; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); flex-shrink: 0; background: var(--paper); }
.store-logo-sm { width: 44px; height: 44px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); flex-shrink: 0; background: var(--paper); }
.store-logo-fallback {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  border: 1px solid var(--gold);
  background: var(--navy);
  color: var(--gold);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: 600 24px/1 var(--serif);
  flex-shrink: 0;
}
.store-logo-fallback.store-logo-sm { width: 44px; height: 44px; border-radius: 10px; font-size: 18px; }
