:root {
  --accent: #b8860b;
  --ink: #1b1712;
  --paper: #faf7f2;
  --card: #ffffff;
  --rule: #e8dfd0;
  --muted: #8a8168;
  --success: #2f6f4e;
  --font-display: 'Fraunces', serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

#app {
  min-height: 100vh;
  min-height: 100dvh; /* actual visible height on mobile, adjusts as the address bar shows/hides */
  display: flex;
  flex-direction: column;
  position: relative;
}

.loading-screen, .error-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  text-align: center;
  font-family: var(--font-display);
  gap: 8px;
  padding: 24px;
}

/* ---------- Decorative corner line art ---------- */

.bg-decor {
  position: fixed;
  width: 220px;
  height: 220px;
  background-image: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjIwIiBoZWlnaHQ9IjIyMCIgdmlld0JveD0iMCAwIDIyMCAyMjAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjYjg4NjBiIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCI+CjxwYXRoIGQ9Ik0xMCAyMTAgQyA2MCAxNjAsIDQwIDEwMCwgMTAwIDYwIEMgMTQwIDM1LCAxNjAgMjAsIDIxMCAxMCIvPgo8cGF0aCBkPSJNNjAgMTUwIEMgNzUgMTQwLCA4NSAxMjUsIDgwIDExMCIvPgo8cGF0aCBkPSJNOTAgMTEwIEMgMTA1IDEwMCwgMTE1IDg1LCAxMDggNzAiLz4KPHBhdGggZD0iTTEyMCA3MCBDIDEzNSA2MCwgMTQ1IDQ4LCAxMzggMzUiLz4KPGVsbGlwc2UgY3g9Ijc4IiBjeT0iMTA4IiByeD0iMTAiIHJ5PSI1IiB0cmFuc2Zvcm09InJvdGF0ZSgtMzAgNzggMTA4KSIvPgo8ZWxsaXBzZSBjeD0iMTA2IiBjeT0iNjgiIHJ4PSI5IiByeT0iNC41IiB0cmFuc2Zvcm09InJvdGF0ZSgtMzAgMTA2IDY4KSIvPgo8ZWxsaXBzZSBjeD0iMTM2IiBjeT0iMzMiIHJ5PSI0IiByeD0iOCIgdHJhbnNmb3JtPSJyb3RhdGUoLTMwIDEzNiAzMykiLz4KPC9zdmc+");
  background-repeat: no-repeat;
  opacity: 0.18;
  pointer-events: none;
  z-index: 0;
}
.bg-decor-top { top: 0; right: 0; }
.bg-decor-bottom { bottom: 0; left: 0; transform: rotate(180deg); }

/* ---------- Top bar ---------- */

.topbar {
  position: relative;
  z-index: 1;
  max-width: 640px;
  margin: 0 auto;
  padding: 26px 20px 4px;
}
.topbar-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.biz-name {
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-weight: 700;
  font-size: 2rem;
  color: var(--accent);
  margin: 0;
  line-height: 1.1;
}

/* ---------- Language dropdown ---------- */

.lang-dropdown {
  position: relative;
  flex-shrink: 0;
  padding-top: 4px;
}
.lang-current {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 6px 12px;
  border-radius: 999px;
  border: none;
  background: var(--ink);
  color: #fff;
  cursor: pointer;
}
.lang-chevron { font-size: 0.65rem; opacity: 0.8; }
.lang-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  min-width: 90px;
  background: var(--card);
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(30, 20, 0, 0.16);
  padding: 4px;
  overflow: hidden;
}
.lang-menu[hidden] { display: none; }
.lang-option {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 8px 12px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  width: 100%;
}
.lang-option:hover, .lang-option:active { background: var(--paper); }

/* ---------- Call waiter / request bill (service row) ---------- */

.service-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
}
.service-btn {
  flex: 1;
  border: 1px solid var(--rule);
  border-radius: 16px;
  padding: 14px 10px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.88rem;
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: transform 0.12s ease;
  box-shadow: 0 2px 8px rgba(30, 20, 0, 0.05);
}
.service-btn:active { transform: scale(0.97); }
.service-icon { font-size: 1.4rem; color: var(--accent); }

/* ---------- Table badge ---------- */

.table-badge-circle {
  flex-shrink: 0;
  min-width: 64px;
  height: 56px;
  padding: 0 16px;
  border-radius: 999px;
  background: #f7ecd3;
  display: flex;
  align-items: center;
  justify-content: center;
}
.table-badge-num {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1;
}

/* ---------- Wifi bar (bottom) ---------- */

.wifi-bar {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 640px;
  margin: 0 auto;
  padding: 10px 20px calc(10px + env(safe-area-inset-bottom, 10px));
  width: 100%;
  background: linear-gradient(to top, var(--paper) 70%, transparent);
}
.wifi-bar .wifi-icon {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: #eaf2fb;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}
.wifi-bar .wifi-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
  font-family: var(--font-body);
  background: var(--card);
  border-radius: 14px;
  padding: 8px 14px;
  box-shadow: 0 2px 8px rgba(30, 20, 0, 0.06);
}
.wifi-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}
.wifi-line {
  font-size: 0.86rem;
  color: var(--ink);
  word-break: break-word;
}
.wifi-key { font-weight: 600; opacity: 0.7; }

/* ---------- Tabs ---------- */

.tabbar {
  position: relative;
  z-index: 1;
  max-width: 640px;
  margin: 14px auto 0;
  display: flex;
  gap: 22px;
  padding: 4px 20px 18px;
}
.tab {
  flex: 1;
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 0;
  cursor: pointer;
}
.tab-icon-btn {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: var(--card);
  box-shadow: 0 2px 8px rgba(30, 20, 0, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s ease, background 0.15s ease;
}
.tab-icon { font-size: 2.1rem; line-height: 1; }
.tab-label {
  font-family: var(--font-body);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
}
.tab:active .tab-icon-btn { transform: scale(0.94); }
.tab.active .tab-icon-btn { background: var(--accent); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22); }
.tab.active .tab-label { color: var(--accent); }

/* ---------- Main ---------- */

main {
  position: relative;
  z-index: 1;
  flex: 1;
  max-width: 640px;
  margin: 0 auto;
  padding: 18px 20px 20px;
  width: 100%;
}

/* ---------- Category cards (level 1) ---------- */

.menu-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.cat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  aspect-ratio: 1 / 1;
  background: var(--card);
  border: none;
  border-radius: 16px;
  padding: 10px 6px;
  box-shadow: 0 2px 10px rgba(30, 20, 0, 0.06);
  cursor: pointer;
  text-align: center;
  width: 100%;
}
.cat-icon-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #faf1de;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.35rem;
}
.cat-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.85rem;
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- Category detail (level 2) ---------- */

.back-btn {
  background: none;
  border: none;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--accent);
  cursor: pointer;
  padding: 4px 0 18px;
}
.detail-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 16px;
}

.items {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.menu-item {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(30, 20, 0, 0.06);
  overflow: hidden;
}

.item-photo-wrap {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #faf1de;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}
.item-photo { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; }
.item-photo-fallback { font-size: 1.6rem; }
.item-photo-zoom-hint {
  position: absolute;
  right: 5px;
  bottom: 5px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 0.7rem;
  line-height: 18px;
  text-align: center;
  pointer-events: none;
}

/* ---------- Photo lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(10, 8, 4, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: lightboxFade 0.15s ease;
  touch-action: pinch-zoom;
}
.lightbox[hidden] { display: none; }
@keyframes lightboxFade { from { opacity: 0; } to { opacity: 1; } }
.lightbox-img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  touch-action: pinch-zoom;
}
.lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox-close:hover { background: rgba(255, 255, 255, 0.28); }

/* ---------- Call waiter / bill request detail sheet ---------- */
.request-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(10, 8, 4, 0.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: lightboxFade 0.15s ease;
}
.request-modal-backdrop[hidden] { display: none; }
.request-modal {
  position: relative;
  width: 100%;
  max-width: 480px;
  background: #fff;
  border-radius: 18px 18px 0 0;
  padding: 22px 20px 20px;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.25);
  animation: sheetUp 0.18s ease;
}
@keyframes sheetUp { from { transform: translateY(16px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.request-modal-title { margin: 0 0 14px; font-size: 1.15rem; padding-right: 30px; font-family: var(--font-display); color: var(--ink); }
.request-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: var(--paper);
  color: var(--muted);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}
.request-chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.request-chip {
  border: 1px solid var(--rule);
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.88rem;
  cursor: pointer;
}
.request-chip.selected { background: var(--accent); border-color: var(--accent); color: #fff; }
.request-note-input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: var(--font-body);
  font-size: 0.92rem;
  resize: none;
  height: 56px;
  margin-bottom: 14px;
}
.request-modal-send {
  width: 100%;
  border: none;
  border-radius: 10px;
  padding: 13px;
  font-size: 1rem;
  font-weight: 600;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

/* ---------- Today's special / promo popup ---------- */
.special-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 550;
  background: rgba(10, 8, 4, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: lightboxFade 0.15s ease;
}
.special-modal-backdrop[hidden] { display: none; }
.special-modal {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.35);
  animation: sheetUp 0.18s ease;
}
.special-modal-img { width: 100%; display: block; max-height: 260px; object-fit: cover; }
.special-modal-img[hidden] { display: none; }
.special-modal-body { padding: 18px 20px 22px; }
.special-modal-title { margin: 0 0 8px; font-family: var(--font-display); font-size: 1.4rem; color: var(--ink); }
.special-modal-desc { margin: 0; color: var(--muted); font-size: 0.95rem; line-height: 1.5; }
.special-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  z-index: 1;
}
.special-modal-close:hover { background: rgba(0, 0, 0, 0.6); }

.item-text { padding: 7px 8px 9px; display: flex; flex-direction: column; gap: 1px; }
.item-name { font-family: var(--font-display); font-weight: 600; font-size: 0.78rem; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.item-price { font-family: var(--font-mono); font-size: 0.76rem; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--accent); }
.item-desc {
  margin: 1px 0 0;
  font-size: 0.68rem;
  color: var(--muted);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.empty-hint { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 20px 0; }

/* ---------- Review tab ---------- */

.review-wrap { text-align: center; padding: 10px 0 30px; }
.review-prompt { font-family: var(--font-display); font-size: 1.5rem; margin: 0 0 4px; }
.review-sub { color: var(--muted); margin: 0 0 24px; }

.stars { display: flex; justify-content: center; gap: 10px; }
.star {
  background: none;
  border: none;
  font-size: 2.4rem;
  line-height: 1;
  color: #ddd0b0;
  cursor: pointer;
  transition: transform 0.15s ease, color 0.15s ease;
  padding: 4px;
}
.star.filled { color: var(--accent); }
.star:active { transform: scale(1.2); }

.review-result { margin-top: 26px; font-family: var(--font-display); font-size: 1.15rem; }

.private-form { margin-top: 26px; display: flex; flex-direction: column; gap: 10px; text-align: left; }
.private-form-lede { font-size: 0.9rem; color: var(--muted); text-align: center; margin: 0 0 6px; }
.private-form textarea, .private-form input {
  font-family: var(--font-body);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 0.95rem;
  background: #fff;
}
.private-form textarea:focus, .private-form input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 13px 18px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 4px;
}
.btn-primary:active { transform: scale(0.98); }

.private-thanks { margin-top: 20px; color: var(--success); font-weight: 600; }

/* ---------- Social tab ---------- */

.social-wrap { text-align: center; padding: 10px 0 30px; }
.social-title { font-family: var(--font-display); font-size: 1.5rem; margin: 0 0 22px; }
.social-row { display: flex; justify-content: center; gap: 16px; flex-wrap: wrap; }
.social-icon {
  width: 46px; height: 46px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--card); color: var(--accent);
  text-decoration: none; box-shadow: 0 2px 8px rgba(30, 20, 0, 0.06);
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 0.88rem;
  z-index: 100;
  animation: toast-in 0.2s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }

@media (prefers-reduced-motion: reduce) {
  .service-btn, .star, .btn-primary, .toast { transition: none; animation: none; }
}
