* { box-sizing: border-box; }

:root {
  --brand: #B5EE8B;
  --brand-dark: #8FD966;
  --brand-grad: linear-gradient(135deg, #DFFFC8 0%, #CCF5A8 45%, #B5EE8B 100%);
  --brand-ink: #15210f;
  --brand-soft-bg: rgba(181, 238, 139, 0.14);
  --danger: #ff6b6b;
  --warn: #ffc107;
  --vg-blue: #1D6FA3;
  --ig-bg: #181C19;
  --ig-surface: #1F2420;
  --ig-surface-2: #262C27;
  --ig-border: #343B35;
  --ig-text: #fafafa;
  --ig-text-soft: #a8a8a8;
  --ig-text-faint: #737373;
}

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
}

.hc-splash {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: var(--ig-bg);
  transition: opacity 0.25s ease, visibility 0.25s ease;
}
.hc-splash.hc-splash-hide { opacity: 0; visibility: hidden; pointer-events: none; }
.hc-splash-icon {
  width: 92px; height: 92px; border-radius: 22px; background: var(--brand-grad);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  box-shadow: 0 8px 24px rgba(181, 238, 139, 0.25);
}
.hc-splash-icon img { width: 100%; height: 100%; object-fit: cover; }
.hc-splash-word { font-size: 19px; font-weight: 700; letter-spacing: 0.3px; color: var(--ig-text); }
.hc-splash-tagline { position: absolute; bottom: 56px; left: 0; right: 0; text-align: center; font-size: 12px; color: var(--ig-text-faint); font-weight: 600; }
body {
  font-family: "Noto Sans Thai", -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--ig-bg);
  color: var(--ig-text);
}

.hc-shell {
  max-width: 480px;
  margin: 0 auto;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--ig-bg);
  display: flex;
  flex-direction: column;
}

.hc-header {
  background: var(--ig-bg);
  color: var(--ig-text);
  padding: 16px 20px;
  font-weight: 700;
  font-size: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--ig-border);
}

.hc-header button {
  background: transparent;
  border: 1px solid var(--ig-border);
  color: var(--ig-text-soft);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px;
  cursor: pointer;
}

.hc-header-left { display: flex; align-items: center; gap: 8px; }
.hc-chat-back-btn {
  background: none !important;
  border: none !important;
  color: var(--ig-text);
  padding: 0 !important;
  display: flex;
  align-items: center;
  cursor: pointer;
}

.hc-logo-text {
  color: #afffa2;
}

/* ---- auth ---- */
.hc-auth {
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.hc-auth h2 { margin: 0 0 4px; }
.hc-auth input {
  padding: 12px;
  border: 1px solid var(--ig-border);
  border-radius: 8px;
  font-size: 16px;
  background: var(--ig-surface-2);
  color: var(--ig-text);
}
.hc-auth button {
  padding: 12px;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.hc-btn-primary { background: var(--brand-grad); color: var(--brand-ink); }
.hc-btn-google { background: var(--ig-surface); border: 1px solid var(--ig-border) !important; color: var(--ig-text); }
.hc-auth-toggle { font-size: 13px; color: var(--ig-text-soft); text-align: center; cursor: pointer; }
.hc-auth-error { color: var(--danger); font-size: 13px; }
/* Language trigger on the pre-login auth screen (global customers must be
   able to switch language before signing up). ".hc-auth button" would win on
   specificity alone, hence the compound selector. */
.hc-auth button.hc-auth-lang-btn {
  align-self: flex-end;
  display: flex; align-items: center; gap: 6px;
  padding: 8px 12px;
  border: 1px solid var(--ig-border);
  border-radius: 999px;
  background: var(--ig-surface-2);
  color: var(--ig-text);
  font-size: 13px;
  font-weight: 500;
}

/* ---- bottom nav (5 tabs: หน้าหลัก / ค้นหา / สร้างโพสต์ / แชท / บัญชี) ---- */
.hc-bottom-nav-5 {
  display: flex;
  align-items: flex-end;
  border-top: 1px solid var(--ig-border);
  flex-shrink: 0;
  background: var(--ig-bg);
  position: relative;
  padding: 0 4px;
  padding-bottom: env(safe-area-inset-bottom);
}
.hc-tab5 {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 9px 0 6px;
  cursor: pointer;
  font-size: 10.5px;
  color: var(--ig-text-faint);
  background: none;
  border: none;
}
.hc-tab5.active { color: var(--brand); font-weight: 700; }
.hc-tab5-create {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  margin-top: -22px;
  cursor: pointer;
  background: none;
  border: none;
}
.hc-tab5-create-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--brand-grad);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand-ink);
  box-shadow: 0 4px 12px rgba(95, 212, 92, 0.5);
  border: 3px solid var(--ig-bg);
}
.hc-navicon { display: flex; align-items: center; justify-content: center; }
.hc-navicon svg { width: 21px; height: 21px; display: block; }
/* Outline icon while inactive, filled/solid icon when the tab is selected --
   the familiar "natural" app pattern (Instagram/LINE/etc bottom nav). */
.hc-navicon .hc-icon-filled { display: none; }
.hc-tab5.active .hc-navicon .hc-icon-outline { display: none; }
.hc-tab5.active .hc-navicon .hc-icon-filled { display: block; }

/* ---- home feed (IG-style single-column scroll) ---- */
.hc-home { flex: 1; min-height: 0; overflow-y: auto; background: var(--ig-bg); }
.hc-feed { display: flex; flex-direction: column; gap: 14px; padding: 10px 10px; }
.hc-feed-refresh-indicator { height: 0; overflow: hidden; display: flex; align-items: center; justify-content: center; transition: height 0.15s ease; }
.hc-feed-refresh-indicator.hc-feed-refreshing { transition: none; }
.hc-feed-refresh-spinner { width: 20px; height: 20px; border: 2px solid var(--ig-border); border-top-color: var(--brand); border-radius: 50%; animation: hc-feed-spin 0.6s linear infinite; }
@keyframes hc-feed-spin { to { transform: rotate(360deg); } }
.hc-feed-empty { padding: 60px 20px; text-align: center; color: var(--ig-text-faint); font-size: 14px; }

/* ---- loading skeletons (feed cold-start + account tab) ---- */
@keyframes hc-skeleton-shimmer { 0% { background-position: -200px 0; } 100% { background-position: 200px 0; } }
.hc-skeleton {
  background: linear-gradient(90deg, var(--ig-surface) 25%, var(--ig-surface-2) 37%, var(--ig-surface) 63%);
  background-size: 400px 100%;
  animation: hc-skeleton-shimmer 1.4s ease infinite;
  border-radius: 6px;
}
.hc-skeleton-card { padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; }
.hc-skeleton-avatar { width: 34px; height: 34px; border-radius: 50%; }
.hc-skeleton-avatar-big { width: 72px; height: 72px; border-radius: 50%; }
.hc-skeleton-media { width: 100%; aspect-ratio: 1 / 1; border-radius: 4px; }
.hc-skeleton-line { height: 12px; }
.hc-skeleton-grid-cell { aspect-ratio: 1 / 1; border-radius: 2px; }

/* ---- lazy image fade-in (blur-up style handoff from placeholder bg) ---- */
.hc-img-fade { opacity: 0; transition: opacity 0.25s ease; }
.hc-img-fade.hc-img-fade-loaded { opacity: 1; }

/* ---- tab-switch arrival fade (replaces an instant hc-hidden "snap") ---- */
@keyframes hc-tab-fade-in { from { opacity: 0; } to { opacity: 1; } }
.hc-tab-panel-enter { animation: hc-tab-fade-in 0.18s ease; }
.hc-post-card { background: var(--ig-surface); border-radius: 18px; overflow: hidden; box-shadow: 0 2px 10px rgba(0,0,0,0.35); }
.hc-post-author-row { display: flex; align-items: center; gap: 8px; padding: 12px 16px 10px; cursor: pointer; }
.hc-post-author-name { font-weight: 700; font-size: 13.5px; color: var(--ig-text); }
.hc-post-author-badge { font-size: 10.5px; background: var(--brand-soft-bg); color: var(--brand); border-radius: 10px; padding: 2px 8px; font-weight: 600; margin-left: auto; flex-shrink: 0; }
.hc-avatar-img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; display: block; flex-shrink: 0; }
.hc-avatar-fallback {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center;
  justify-content: center; background: var(--brand-grad); color: var(--brand-ink); font-weight: 700; font-size: 14px;
}
.hc-post-media { width: 100%; aspect-ratio: 1 / 1; background: #000; overflow: hidden; position: relative; border-radius: 14px; }
.hc-post-media img, .hc-post-media video { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Single-video posts: don't force a square crop (that cuts off vertical
   video) -- let the video keep its natural aspect ratio instead. Multi-media
   carousels keep the fixed square frame below, since mixing variable-height
   items there would break the swipe layout. */
.hc-post-media:not(.hc-carousel):has(video) { aspect-ratio: auto; }
.hc-post-media:not(.hc-carousel):has(video) video { height: auto; max-height: 70vh; object-fit: contain; }
.hc-post-media.hc-carousel { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.hc-post-media.hc-carousel::-webkit-scrollbar { display: none; }
.hc-post-media .hc-carousel-item { flex: 0 0 100%; width: 100%; height: 100%; scroll-snap-align: start; }
.media-count-badge {
  position: absolute; top: 10px; right: 10px; background: rgba(0, 0, 0, 0.55); color: #fff; font-size: 11px;
  border-radius: 10px; padding: 3px 8px 3px 7px; display: flex; align-items: center; gap: 4px; font-weight: 600;
}
.carousel-dots { position: absolute; bottom: 10px; left: 0; right: 0; display: flex; justify-content: center; gap: 5px; pointer-events: none; }
.carousel-dot { width: 5px; height: 5px; border-radius: 50%; background: rgba(255, 255, 255, 0.55); }
.carousel-dot.active { background: #fff; width: 6px; height: 6px; }
.hc-post-body { padding: 12px 16px; }
.hc-post-caption { font-size: 14px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.hc-post-caption .hc-hashtag { color: var(--brand); font-weight: 600; cursor: pointer; }
.hc-post-caption-clamped { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.hc-post-caption-more { margin-top: 2px; display: block; background: none; border: none; padding: 0; font-family: inherit; font-size: 14px; font-weight: 600; color: var(--ig-text-faint); cursor: pointer; }
.hc-post-caption-translate { margin-top: 6px; display: block; background: none; border: none; padding: 0; font-family: inherit; font-size: 13px; font-weight: 600; color: var(--brand); cursor: pointer; }
.hc-post-caption-translate:disabled { color: var(--ig-text-faint); cursor: default; }
.hc-post-package {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--ig-surface-2);
  border-radius: 10px;
  padding: 10px 12px;
}
.hc-post-package-name { font-size: 13px; font-weight: 600; color: var(--ig-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hc-post-package-btn {
  flex-shrink: 0;
  background: var(--brand-grad);
  color: var(--brand-ink);
  border: none;
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
}
.hc-post-time { font-size: 11px; color: var(--ig-text-faint); margin-top: 8px; }

.hc-post-actions { display: flex; align-items: center; gap: 18px; padding: 10px 16px 0; }
.hc-like-btn, .hc-comment-btn {
  display: flex; align-items: center; gap: 6px; background: none; border: none; padding: 0;
  cursor: pointer; color: var(--ig-text-faint); font-size: 13px; font-weight: 600;
}
.hc-like-btn .hc-like-icon { stroke: var(--ig-text-faint); fill: none; stroke-width: 2; transition: fill 0.15s, stroke 0.15s; }
.hc-like-btn.hc-liked .hc-like-icon { fill: var(--brand); stroke: var(--brand); }
.hc-like-btn.hc-liked .hc-like-count { color: var(--brand); }
.hc-comment-btn svg { stroke: var(--ig-text-faint); }
.hc-bookmark-btn, .hc-share-btn {
  display: flex; align-items: center; background: none; border: none; padding: 0;
  cursor: pointer; color: var(--ig-text-faint);
}
.hc-bookmark-btn { margin-left: auto; }
.hc-bookmark-btn .hc-bookmark-icon { stroke: var(--ig-text-faint); fill: none; stroke-width: 2; transition: fill 0.15s, stroke 0.15s; }
.hc-bookmark-btn.hc-bookmarked .hc-bookmark-icon { fill: var(--brand); stroke: var(--brand); }
.hc-share-btn svg { stroke: var(--ig-text-faint); }
.hc-comments-list { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; max-height: 240px; overflow-y: auto; }
.hc-comments-empty { color: var(--ig-text-faint); font-size: 13px; text-align: center; padding: 16px 0; }
.hc-comment-row { display: flex; align-items: flex-start; gap: 8px; }
.hc-comment-avatar-img, .hc-comment-avatar-fallback { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; flex: none; }
.hc-comment-avatar-fallback { display: flex; align-items: center; justify-content: center; background: var(--brand); color: var(--brand-ink); font-weight: 700; font-size: 11px; }
.hc-comment-body { flex: 1; min-width: 0; font-size: 13px; line-height: 1.4; }
.hc-comment-author { font-weight: 700; color: var(--ig-text); margin-right: 6px; }
.hc-comment-text { color: var(--ig-text); overflow-wrap: anywhere; }
.hc-comment-delete-btn { background: none; border: none; color: var(--ig-text-faint); cursor: pointer; font-size: 13px; flex: none; padding: 0 4px; }
.hc-comment-input-row { display: flex; gap: 8px; margin-top: 12px; align-items: center; }
#hc-comment-input { flex: 1; border: 1px solid var(--ig-border); background: var(--ig-surface-2); color: var(--ig-text); border-radius: 20px; padding: 8px 14px; font-size: 16px; outline: none; }
#hc-comment-send-btn { background: var(--brand-grad); color: var(--brand-ink); border: none; border-radius: 20px; padding: 8px 16px; font-size: 13px; cursor: pointer; flex: none; }

/* ---- chat ---- */
.hc-chat { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.hc-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.hc-msg-row { display: flex; align-items: flex-end; gap: 4px; width: 100%; }
.hc-msg-row-customer { justify-content: flex-end; }
.hc-msg-row-admin { justify-content: flex-start; }
.hc-msg-row-system { justify-content: center; }
.hc-msg-row-customer .hc-reply-btn { order: -1; }

.hc-msg { max-width: 78%; padding: 10px 14px; border-radius: 14px; font-size: 14px; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; }
.hc-msg img { max-width: 100%; border-radius: 10px; display: block; margin-top: 6px; cursor: pointer; }
.hc-msg-customer { background: var(--brand-grad); color: var(--brand-ink); font-weight: 600; border-bottom-right-radius: 4px; }
.hc-msg-admin { background: var(--ig-surface-2); color: var(--ig-text); border-bottom-left-radius: 4px; }
.hc-msg-system { background: transparent; color: var(--ig-text-faint); font-size: 12px; }
.hc-msg-ticks { display: block; text-align: right; font-size: 11px; margin-top: 3px; color: rgba(13, 43, 12, 0.55); letter-spacing: -1px; }
.hc-msg-ticks-read { color: #1D6FA3; }
.hc-msg-row-pending { opacity: 0.55; }

.hc-reply-btn {
  flex: none;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 4px;
  opacity: 0.35;
  align-self: center;
}
.hc-reply-btn:hover { opacity: 1; }

.hc-msg-quote {
  font-size: 12px;
  opacity: 0.8;
  border-left: 3px solid currentColor;
  padding: 2px 8px;
  margin-bottom: 6px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hc-msg.hc-msg-highlight { outline: 2px solid var(--brand); outline-offset: 2px; }

.hc-msg-post-card {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px; padding: 6px 8px; margin-bottom: 6px; cursor: pointer;
}
.hc-msg-admin .hc-msg-post-card { background: rgba(0, 0, 0, 0.18); }
.hc-msg-post-card img { width: 38px; height: 38px; border-radius: 7px; object-fit: cover; flex: none; margin: 0; }
.hc-msg-post-card-body { min-width: 0; overflow: hidden; }
.hc-msg-post-card-label { font-size: 10px; opacity: 0.75; }
.hc-msg-post-card-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.hc-reply-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 14px;
  background: var(--ig-surface-2);
  border-top: 1px solid var(--ig-border);
  border-left: 3px solid var(--brand);
  font-size: 13px;
}
.hc-reply-preview-label { font-size: 11px; color: var(--brand); font-weight: 600; }
.hc-reply-preview-text { color: var(--ig-text-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hc-reply-cancel { border: none; background: none; cursor: pointer; font-size: 14px; color: var(--ig-text-faint); }

.hc-composer {
  display: flex;
  gap: 8px;
  padding: 12px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--ig-border);
}
.hc-composer textarea {
  flex: 1;
  padding: 10px 14px;
  border-radius: 20px;
  border: 1px solid var(--ig-border);
  font-size: 16px;
  font-family: inherit;
  resize: none;
  max-height: 120px;
  line-height: 1.4;
  background: var(--ig-surface-2);
  color: var(--ig-text);
}
.hc-composer button {
  border: none;
  background: var(--brand-grad);
  color: var(--brand-ink);
  border-radius: 20px;
  padding: 0 16px;
  cursor: pointer;
  font-size: 14px;
}
.hc-attach-btn { background: var(--ig-surface-2) !important; color: var(--ig-text) !important; width: 40px; padding: 0 !important; display: flex; align-items: center; justify-content: center; }
.hc-attach-btn svg { width: 20px; height: 20px; display: block; }
.hc-send-btn {
  width: 44px; padding: 0 !important; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  /* Belt-and-suspenders: skips iOS's double-tap-zoom gesture disambiguation
     on this button. The actual fix for the standalone-mode "needs multiple
     taps to send" bug is in chat.js (touchend fires sendText() directly,
     not relying on the synthesized click event) -- see the comment there
     for the full root cause. */
  touch-action: manipulation;
}
.hc-send-btn svg { display: block; pointer-events: none; }

/* ---- loyalty ---- */
.hc-loyalty { flex: 1; min-height: 0; padding: 20px; display: flex; flex-direction: column; gap: 18px; overflow-y: auto; }
.hc-tier-card {
  background: var(--brand-grad);
  color: var(--brand-ink);
  border-radius: 14px;
  padding: 18px;
}
.hc-tier-card .hc-tier-name { font-size: 20px; font-weight: 700; text-transform: uppercase; }
.hc-tier-card .hc-points { font-size: 28px; font-weight: 700; margin-top: 6px; }
.hc-tier-card .hc-sub { font-size: 12px; opacity: 0.9; margin-top: 4px; }

.hc-section-title { font-weight: 700; font-size: 15px; margin-bottom: 8px; }
.hc-redeem-options { display: flex; flex-direction: column; gap: 10px; }
.hc-redeem-card {
  border: 1px solid var(--ig-border);
  border-radius: 10px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.hc-redeem-card input { padding: 8px; border-radius: 6px; border: 1px solid var(--ig-border); background: var(--ig-surface-2); color: var(--ig-text); font-size: 16px; }
.hc-redeem-card button { background: var(--brand-grad); color: var(--brand-ink); border: none; border-radius: 6px; padding: 8px; cursor: pointer; }

.hc-history-item { font-size: 13px; display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--ig-border); }
.hc-history-item.earn { color: var(--brand); }
.hc-history-item.spend { color: var(--danger); }

.hc-hidden { display: none !important; }

/* ---- image lightbox ---- */
.hc-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hc-lightbox img {
  max-width: 92vw;
  max-height: 92vh;
  border-radius: 8px;
}
.hc-lightbox-close {
  position: absolute;
  top: max(16px, env(safe-area-inset-top));
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

/* ---- search / discover tab ---- */
.hc-search { flex: 1; min-height: 0; overflow-y: auto; }
.search-header { padding: 14px 16px; font-weight: 700; font-size: 16px; border-bottom: 1px solid var(--ig-border); color: var(--ig-text); }
.search-box {
  margin: 14px 16px; display: flex; align-items: center; gap: 8px; background: var(--ig-surface-2); border-radius: 20px;
  padding: 10px 14px; color: var(--ig-text-faint); font-size: 13.5px;
}
.search-box input { flex: 1; border: none; background: none; outline: none; font-size: 16px; font-family: inherit; color: var(--ig-text); }
.trend-section-title { padding: 4px 16px; font-size: 13px; font-weight: 700; color: var(--ig-text); display: flex; align-items: center; gap: 6px; }
.trend-chip-row { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px 14px; }
.trend-chip { background: var(--brand-soft-bg); color: var(--brand); font-size: 12.5px; font-weight: 600; border-radius: 16px; padding: 6px 12px; cursor: pointer; border: none; }
.trend-chip .cnt { color: var(--ig-text-faint); font-weight: 400; margin-left: 4px; }
.hc-people-list { display: flex; flex-direction: column; }
.ig-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; padding: 0 2px; }
.ig-grid-cell { position: relative; aspect-ratio: 1 / 1; background: #000; overflow: hidden; cursor: pointer; }
.ig-grid-cell img, .ig-grid-cell video { width: 100%; height: 100%; object-fit: cover; display: block; }
.ig-grid-badge { position: absolute; top: 6px; right: 6px; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6)); }
.ig-grid-play-badge {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 36px; height: 36px;
  border-radius: 50%; background: rgba(0, 0, 0, 0.4); display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.ig-grid-empty { grid-column: 1 / -1; padding: 40px 20px; text-align: center; color: var(--ig-text-faint); font-size: 13px; }

/* ---- search redesign v1: post-card grid (search tab only) ---- */
.sr-post-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 16px 16px; }
.sr-post-card { background: var(--ig-surface); border: 1px solid var(--ig-border); border-radius: 10px; overflow: hidden; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25); cursor: pointer; }
.sr-post-media { width: 100%; aspect-ratio: 4 / 3; background: var(--ig-surface-2); background-size: cover; background-position: center; position: relative; }
.sr-post-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sr-post-save {
  position: absolute; top: 7px; right: 7px; width: 22px; height: 22px; border-radius: 50%;
  background: rgba(0, 0, 0, 0.45); display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 11px; border: none; cursor: pointer; padding: 0;
}
.sr-post-save.hc-bookmarked { background: var(--brand); }
.sr-post-badge { position: absolute; top: 7px; left: 7px; background: rgba(0, 0, 0, 0.55); color: #fff; font-size: 9.5px; padding: 2px 6px; border-radius: 8px; }
.sr-post-play-badge {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 30px; height: 30px;
  border-radius: 50%; background: rgba(0, 0, 0, 0.4); display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.sr-post-body { padding: 8px 9px 10px; }
.sr-post-caption { font-size: 11.5px; color: var(--ig-text); line-height: 1.4; max-height: 30px; overflow: hidden; }
.sr-post-owner { display: flex; align-items: center; gap: 5px; margin-top: 7px; }
.sr-post-avatar { width: 16px; height: 16px; border-radius: 50%; object-fit: cover; flex-shrink: 0; display: block; }
.sr-post-avatar-fallback {
  width: 16px; height: 16px; border-radius: 50%; flex-shrink: 0; background: var(--brand); color: var(--brand-ink);
  font-size: 9px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.sr-post-owner-name { font-size: 10px; color: var(--ig-text-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-post-loc { font-size: 9.5px; color: var(--ig-text-faint); margin-top: 2px; }

/* ---- search redesign v1: destination pill + category grid + result tabs + service shortcut cards ---- */
.sr-dest-row { display: flex; gap: 8px; padding: 0 16px 10px; }
.sr-dest-pill {
  appearance: none; -webkit-appearance: none; background: var(--ig-surface-2); border: none; border-radius: 14px;
  color: var(--ig-text-soft); font-size: 12px; font-weight: 600; padding: 7px 14px; font-family: inherit;
}
.sr-cat-section { padding: 4px 16px 6px; }
.sr-cat-hint { font-size: 12px; color: var(--ig-text-faint); margin-bottom: 10px; }
.sr-cat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.sr-cat-card {
  background: var(--ig-surface); border: 1px solid var(--ig-border); border-radius: 14px; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  padding: 14px 6px; display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer;
}
.sr-cat-icon {
  width: 38px; height: 38px; border-radius: 10px; background: var(--brand-soft-bg); display: flex; align-items: center;
  justify-content: center; font-size: 18px;
}
.sr-cat-name { font-size: 11.5px; font-weight: 600; color: var(--ig-text); text-align: center; }
.sr-cat-sub { font-size: 9.5px; color: var(--ig-text-faint); text-align: center; }

.sr-tabs { display: flex; border-bottom: 1px solid var(--ig-border); padding: 0 8px; }
.sr-tab { flex: 1; text-align: center; padding: 11px 0; font-size: 12.5px; font-weight: 600; color: var(--ig-text-faint); border-bottom: 2px solid transparent; cursor: pointer; }
.sr-tab.active { color: var(--ig-text); border-bottom-color: var(--brand); }

.sr-svc-card {
  margin: 0 16px 10px; background: var(--ig-surface); border: 1px solid var(--ig-border); border-radius: 14px; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  padding: 13px 14px; display: flex; align-items: center; gap: 12px; cursor: pointer;
}
.sr-svc-icon { width: 36px; height: 36px; border-radius: 9px; background: var(--brand-soft-bg); display: flex; align-items: center; justify-content: center; font-size: 17px; flex-shrink: 0; }
.sr-svc-text { flex: 1; min-width: 0; }
.sr-svc-title { font-size: 12.5px; font-weight: 700; color: var(--ig-text); }
.sr-svc-sub { font-size: 10.5px; color: var(--ig-text-faint); margin-top: 2px; }
.sr-svc-btn { background: var(--brand); color: var(--brand-ink); font-size: 11px; font-weight: 700; padding: 7px 12px; border-radius: 8px; white-space: nowrap; }

/* ---- account tab: profile header + tier chip button + my-posts grid ---- */
.hc-account { flex: 1; min-height: 0; overflow-y: auto; padding-bottom: 20px; }
.account-profile-row { display: flex; align-items: center; gap: 12px; padding: 18px 20px 14px; }
.profile-stats-row.account-stats-row { justify-content: flex-start; gap: 16px; margin-top: 4px; }
.account-avatar-wrap { position: relative; width: 58px; height: 58px; flex: none; cursor: pointer; }
.account-avatar-img { width: 58px; height: 58px; border-radius: 50%; object-fit: cover; display: block; }
.account-avatar-fallback {
  width: 58px; height: 58px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--brand-grad); color: var(--brand-ink); font-weight: 700; font-size: 22px;
}
.account-avatar-camera {
  position: absolute; bottom: -2px; right: -2px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--brand); border: 2px solid var(--ig-bg); display: flex; align-items: center; justify-content: center;
}
.account-profile-name { font-weight: 700; font-size: 15.5px; color: var(--ig-text); }
.account-profile-edit { font-size: 11.5px; color: var(--brand); font-weight: 600; margin-top: 2px; cursor: pointer; }
.account-profile-name-row { display: flex; align-items: center; gap: 6px; }
.account-edit-name-btn {
  border: none; background: none; color: var(--ig-text-faint); font-size: 13px; cursor: pointer; padding: 2px 4px; line-height: 1;
}
.hc-editname-notice { font-size: 12px; color: var(--warn); background: rgba(255, 193, 7, 0.12); border-radius: 8px; padding: 8px 10px; margin: 6px 0; line-height: 1.4; }

.tier-chip-btn {
  margin: 0 20px 18px; display: flex; align-items: center; gap: 10px; background: var(--brand-soft-bg); border-radius: 14px;
  padding: 12px 14px; cursor: pointer; border: none; width: calc(100% - 40px); text-align: left;
}
.tier-chip-icon { flex: none; color: var(--brand); }
.tier-chip-body { flex: 1; display: flex; flex-direction: column; }
.tier-chip-title { font-weight: 700; font-size: 14px; color: var(--ig-text); }
.tier-chip-sub { font-size: 11px; color: var(--ig-text-faint); margin-top: 1px; }
.tier-chip-chevron { flex: none; color: var(--brand); opacity: 0.6; }

.account-section-title { padding: 0 20px 8px; font-weight: 700; font-size: 14px; display: flex; justify-content: space-between; align-items: center; color: var(--ig-text); }
.hc-lang-select {
  margin: 0 20px 18px; padding: 10px 12px; border: 1px solid var(--ig-border); border-radius: 8px; font-family: inherit;
  font-size: 16px; background: var(--ig-surface-2); color: var(--ig-text); width: calc(100% - 40px);
}
.hc-lang-trigger-btn {
  margin: 0 20px 18px; padding: 10px 12px; border: 1px solid var(--ig-border); border-radius: 8px; font-family: inherit;
  font-size: 16px; background: var(--ig-surface-2); color: var(--ig-text); width: calc(100% - 40px); display: flex;
  align-items: center; justify-content: space-between; cursor: pointer;
}
.hc-lang-trigger-chevron { color: var(--ig-text-faint); font-size: 18px; }
.hc-lang-picker-modal-inner { border-radius: 16px 16px 0 0; max-height: 75vh; }
.hc-lang-picker-body { padding: 0; gap: 0; }
.hc-lang-picker-list { display: flex; flex-direction: column; }
.hc-lang-picker-item {
  display: flex; align-items: center; gap: 12px; padding: 13px 16px; border: none; background: none;
  border-bottom: 1px solid var(--ig-border); font-family: inherit; font-size: 15px; color: var(--ig-text);
  text-align: left; cursor: pointer; width: 100%;
}
.hc-lang-picker-item.active { background: var(--brand-soft-bg); color: var(--brand); font-weight: 700; }
.hc-lang-picker-flag { font-size: 20px; line-height: 1; }
.hc-lang-picker-name { flex: 1; }
.hc-lang-picker-check { color: var(--brand); font-weight: 700; }
.account-logout-row { padding: 20px; }
.account-logout-row button { width: 100%; padding: 12px; border-radius: 10px; border: 1px solid var(--ig-border); background: var(--ig-surface); color: var(--danger); font-weight: 600; cursor: pointer; }

/* ---- full-screen overlay pages (wallet / mini profile) ---- */
.hc-overlay-page {
  position: absolute; inset: 0; background: var(--ig-bg); z-index: 500; display: flex; flex-direction: column;
}
.hc-overlay-back { background: none; border: none; cursor: pointer; display: flex; align-items: center; color: var(--ig-text); }

/* ---- mini profile of another customer ---- */
.profile-header { padding: 24px 16px; text-align: center; border-bottom: 1px solid var(--ig-border); }
.profile-avatar-big { width: 68px; height: 68px; border-radius: 50%; object-fit: cover; margin: 0 auto 10px; display: block; }
.profile-avatar-big-fallback {
  width: 68px; height: 68px; border-radius: 50%; margin: 0 auto 10px; display: flex; align-items: center;
  justify-content: center; background: var(--brand-grad); color: var(--brand-ink); font-weight: 700; font-size: 26px;
}
.profile-name { font-weight: 700; font-size: 16px; color: var(--ig-text); }
.profile-privacy-note { font-size: 11.5px; color: var(--ig-text-faint); margin-top: 5px; display: flex; align-items: center; justify-content: center; gap: 4px; }
.hc-profile-body { flex: 1; min-height: 0; overflow-y: auto; }

/* ---- follow system (item 2) ---- */
.profile-stats-row { display: flex; justify-content: center; gap: 24px; margin-top: 10px; }
.profile-stat-btn { border: none; background: none; cursor: pointer; font-size: 12.5px; color: var(--ig-text-soft); font-family: inherit; }
.profile-stat-btn span:first-child { font-weight: 700; color: var(--ig-text); margin-right: 3px; }
.hc-follow-btn {
  margin-top: 12px; padding: 8px 28px; border-radius: 8px; border: none; background: var(--brand-grad); color: var(--brand-ink);
  font-weight: 700; font-size: 13.5px; cursor: pointer;
}
.hc-follow-btn-active { background: var(--ig-surface); border: 1px solid var(--ig-border); color: var(--ig-text); }
.hc-people-row { display: flex; align-items: center; gap: 10px; padding: 10px 16px; cursor: pointer; }
.hc-people-row-body { display: flex; flex-direction: column; }
.hc-people-row-name { font-weight: 700; font-size: 13.5px; color: var(--ig-text); }
.hc-people-row-username { font-size: 11.5px; color: var(--ig-text-faint); }

/* ---- full tier / wallet page ---- */
.hc-wallet-body { flex: 1; min-height: 0; overflow-y: auto; }
.wallet-topbar { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--ig-border); font-weight: 700; font-size: 15px; color: var(--ig-text); }
.wallet-card { margin: 16px 20px; background: var(--brand-grad); color: var(--brand-ink); border-radius: 16px; padding: 18px; }
.wallet-card-tier { font-size: 16px; font-weight: 700; text-transform: uppercase; }
.wallet-card-balance { font-size: 26px; font-weight: 700; margin-top: 6px; }
.wallet-card-sub { font-size: 11px; opacity: 0.9; margin-top: 3px; }
.wallet-card-fx-hint { font-size: 12px; opacity: 0.85; margin-top: 2px; }
.wallet-withdraw-btn {
  margin: 0 20px 18px; background: var(--brand-grad); color: var(--brand-ink); text-align: center; padding: 12px; border-radius: 12px;
  font-weight: 700; font-size: 13.5px; cursor: pointer; border: none; width: calc(100% - 40px);
}
.wallet-history-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 20px; border-bottom: 1px solid var(--ig-border); font-size: 13px; }
.wallet-history-label { font-weight: 600; color: var(--ig-text); }
.wallet-history-date { font-size: 11px; color: var(--ig-text-faint); margin-top: 2px; }
.wallet-history-amt-plus { color: var(--brand); font-weight: 700; }
.wallet-history-amt-minus { color: var(--danger); font-weight: 700; }
.wallet-history-thb { font-size: 11px; font-weight: 400; color: var(--ig-text-faint); text-align: right; }
.hc-wallet-forms { padding: 0 20px 10px; display: flex; flex-direction: column; gap: 10px; }
.wallet-input-thb-hint { font-size: 12px; color: var(--ig-text-soft); margin: -4px 0 2px 4px; }
.wallet-input-thb-hint:empty { display: none; }

/* ---- create-post modal ---- */
.hc-modal-backdrop {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.7); z-index: 900; display: flex;
  align-items: flex-end; justify-content: center;
}
.hc-modal {
  background: var(--ig-surface); border-radius: 16px 16px 0 0; width: 100%; max-width: 480px; max-height: 88vh;
  display: flex; flex-direction: column; overflow: hidden;
}
.hc-modal-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--ig-border); font-weight: 700; color: var(--ig-text); }
.hc-modal-header button { border: none; background: none; font-size: 16px; cursor: pointer; color: var(--ig-text-faint); }
.hc-modal-body { padding: 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.hc-modal-body textarea { width: 100%; padding: 10px; border: 1px solid var(--ig-border); border-radius: 8px; font-family: inherit; font-size: 16px; resize: vertical; min-height: 70px; background: var(--ig-surface-2); color: var(--ig-text); }
.hc-modal-body input { width: 100%; padding: 10px; border: 1px solid var(--ig-border); border-radius: 8px; font-family: inherit; font-size: 16px; background: var(--ig-surface-2); color: var(--ig-text); }
.hc-post-media-picker { display: flex; gap: 8px; flex-wrap: wrap; }
.hc-post-media-thumb { position: relative; width: 72px; height: 72px; border-radius: 8px; overflow: hidden; background: var(--ig-surface-2); }
.hc-post-media-thumb img, .hc-post-media-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.hc-post-media-thumb-remove {
  position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; border-radius: 50%; border: none;
  background: rgba(0, 0, 0, 0.6); color: #fff; font-size: 11px; line-height: 1; cursor: pointer;
}
.hc-post-media-add {
  width: 72px; height: 72px; border-radius: 8px; border: 1px dashed var(--ig-border); display: flex; align-items: center;
  justify-content: center; color: var(--ig-text-faint); cursor: pointer; flex-shrink: 0;
}
.hc-modal-submit { padding: 12px; border: none; border-radius: 10px; background: var(--brand-grad); color: var(--brand-ink); font-weight: 700; cursor: pointer; }
.hc-modal-note { font-size: 11.5px; color: var(--ig-text-faint); }
.hc-post-upload-status { font-size: 12px; color: var(--danger); min-height: 14px; }
.hc-post-media-thumb-cover-btn {
  position: absolute; bottom: 2px; left: 2px; right: 2px; font-size: 9.5px; line-height: 1; border: none;
  border-radius: 4px; padding: 3px 2px; background: rgba(0, 0, 0, 0.6); color: #fff; cursor: pointer;
}
.hc-poster-picker-video { width: 100%; max-height: 50vh; border-radius: 8px; background: #000; display: block; }
.hc-poster-picker-range { width: 100%; }

/* ---- first-login onboarding modal ---- */
.hc-onboarding-modal { border-radius: 16px; max-width: 360px; margin: auto; }
.hc-onboarding-avatar-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.hc-onboarding-avatar-slot { width: 84px; height: 84px; border-radius: 50%; overflow: hidden; background: var(--ig-surface-2); }
.hc-onboarding-avatar-slot img { width: 100%; height: 100%; object-fit: cover; }
.hc-onboarding-avatar-slot > div { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 28px; font-weight: 700; color: var(--ig-text-faint); background: var(--ig-surface-2); }
.hc-onboarding-avatar-btn { border: none; background: none; color: var(--brand); font-size: 13px; font-weight: 600; cursor: pointer; }
.hc-onboarding-error { color: var(--danger); font-size: 12.5px; }
.hc-field-label { font-size: 12.5px; font-weight: 600; color: var(--ig-text-soft); margin-bottom: -6px; }
/* Account-tab country picker reuses .hc-lang-select sizing; the hint sits
   tight under it, so pull the select's own bottom margin in. */
.hc-account-country-select { margin-bottom: 6px; }
.account-country-hint { padding: 0 20px 18px; font-size: 11.5px; color: var(--ig-text-faint); }

/* ---- own-post detail modal (view/edit/delete) ---- */
.hc-post-detail-modal { max-height: 92vh; }
.hc-post-detail-media { display: flex; gap: 6px; overflow-x: auto; scroll-snap-type: x mandatory; border-radius: 10px; }
.hc-post-detail-media img, .hc-post-detail-media video {
  max-width: 100%; max-height: 360px; object-fit: contain; border-radius: 10px; flex-shrink: 0; scroll-snap-align: start;
  background: var(--ig-surface-2);
}
.hc-post-detail-media:has(> :only-child) img, .hc-post-detail-media:has(> :only-child) video { max-width: 100%; }
.hc-post-detail-status { font-size: 11.5px; font-weight: 700; color: var(--ig-text-faint); }
.hc-post-detail-status.hc-status-rejected { color: var(--danger); }
.hc-post-detail-status.hc-status-pending_review { color: var(--warn); }
.hc-post-detail-actions { display: flex; gap: 10px; }
.hc-post-detail-actions .hc-modal-submit { flex: 1; }
.hc-post-detail-delete {
  flex: 1; padding: 12px; border: 1px solid var(--danger); border-radius: 10px; background: var(--ig-surface); color: var(--danger);
  font-weight: 700; cursor: pointer;
}

/* ---- public post viewer (IG-style author header + follow) ---- */
.hc-view-post-modal { max-height: 92vh; }
.hc-view-post-author-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.hc-view-post-author-link { display: flex; align-items: center; gap: 8px; cursor: pointer; flex: 1; min-width: 0; }
.hc-view-post-avatar-img, .hc-view-post-avatar-fallback { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex: none; }
.hc-view-post-avatar-fallback { display: flex; align-items: center; justify-content: center; background: var(--brand-grad); color: var(--brand-ink); font-weight: 700; font-size: 14px; }
.hc-view-post-author-name { font-weight: 700; font-size: 13.5px; color: var(--ig-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hc-view-post-follow-btn { margin-top: 0; padding: 6px 16px; font-size: 12.5px; flex: none; }
.hc-view-post-caption { font-size: 13.5px; color: var(--ig-text); margin-top: 10px; white-space: pre-wrap; }

/* ---- avatar crop modal (square crop box, circular preview mask) ---- */
.hc-avatar-crop-body { align-items: center; }
.hc-avatar-crop-viewport { width: 280px; height: 280px; max-width: 100%; background: var(--ig-surface-2); overflow: hidden; }
.hc-avatar-crop-viewport img { display: block; max-width: 100%; }
.hc-avatar-crop-viewport .cropper-view-box { border-radius: 50%; outline: 1px solid rgba(255, 255, 255, 0.6); }
.hc-avatar-crop-viewport .cropper-face { border-radius: 50%; }

/* ---- SEO fallback pages (server-rendered /p/:id and /u/:id, no JS) ---- */
.hc-seo-page { max-width: 480px; margin: 0 auto; padding: 20px 16px 40px; font-family: inherit; background: var(--ig-bg); color: var(--ig-text); }
.hc-seo-page img, .hc-seo-page video { max-width: 100%; border-radius: 10px; margin-bottom: 10px; display: block; }
.hc-seo-grid { display: flex; flex-wrap: wrap; gap: 4px; }
.hc-seo-page a { color: var(--brand); font-weight: 600; text-decoration: none; }
