:root {
  /* 🏰 中世紀酒館：羊皮紙冒險風核心色調 */
  --bg-main: #F7F4EB;      /* 羊皮紙淺色底 */
  --bg-surface: #E3DAC9;   /* 羊皮紙深色面 */
  --text-main: #2C221E;    /* 深木炭褐 */
  --color-brand: #1F5A85;  /* 航海藍 */
  
  --primary: var(--color-brand);
  --primary-hover: #15456b;
  --secondary: #5d4037;    /* 熟褐 */
  --accent: #8d6e63;
  --bg-light: var(--bg-main);
  --card-bg: #fff;
  --border-dark: var(--text-main);
  
  --shadow-flat: 2px 2px 0px var(--text-main);
  --shadow-flat-lg: 4px 4px 0px var(--text-main);
  
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-md: 0 4px 12px -2px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
  --card-cols: 6; 
}

* {
  box-sizing: border-box;
  outline: none !important;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-main);
  margin: 0;
  padding: 0;
  color: var(--text-main);
  line-height: 1.6;
}

/* 🏠 頂層與分頁按鈕 */
.app-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 15px;
  position: relative;
}

.header { margin-bottom: 20px; }
.header-toolbar { width: 100%; }

/* === Bottom nav shell (mega + sub tabs) === */
.app-bottom-nav {
  width: 100%;
  margin-bottom: 12px;
}
.app-bottom-nav .mega-tab-buttons {
  margin-bottom: 0;
}
.app-bottom-nav .sub-tab-row {
  margin-bottom: 0;
}
.header-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  flex-wrap: wrap;
  gap: 15px;
}

/* === Mega Tab Buttons (3 main categories) === */
.mega-tab-buttons {
  display: flex;
  flex-wrap: nowrap;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 0;
  width: 100%;
}

.mega-tab-btn {
  flex: 1;
  min-width: 0;
  padding: 12px 10px;
  background: var(--bg-surface);
  border: 2px solid var(--text-main);
  border-radius: 14px 14px 0 0;
  font-size: clamp(13px, 3.5vw, 16px);
  font-weight: 800;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: center;
  box-shadow: var(--shadow-flat);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  border-bottom: 3px solid transparent;
}

.mega-tab-btn:hover {
  background-color: #EDE6D9;
}
.mega-tab-btn:active {
  transform: scale(0.97);
}

.mega-tab-btn.active {
  background: white;
  color: var(--color-brand);
  border-color: var(--color-brand);
  border-bottom: 3px solid var(--color-brand);
  box-shadow: 2px 2px 0px var(--color-brand);
}

/* === Sub Tab Row === */
.sub-tab-row {
  display: flex;
  gap: 8px;
  padding: 10px 8px;
  background: rgba(255,255,255,0.7);
  border-radius: 0 0 12px 12px;
  border: 1px solid #e2e8f0;
  border-top: none;
  margin-bottom: 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.sub-tab-group {
  display: flex;
  gap: 8px;
  width: 100%;
  justify-content: center;
}

.sub-tab-btn {
  padding: 8px 18px;
  background: white;
  border: 1.5px solid #cbd5e1;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 800;
  color: #334155;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.sub-tab-btn:hover {
  background: #f8fafc;
  transform: translateY(-1px);
}

.sub-tab-btn.active {
  background: var(--color-brand);
  color: white;
  border-color: var(--color-brand);
  box-shadow: 0 3px 8px rgba(0,0,0,0.15);
  transform: translateY(-1px);
}

.sub-tab-btn svg.sub-icon {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Keep unread-chat indicator styles for mega-tab-social */
.mega-tab-btn.has-unread-chat,
.sub-tab-btn.has-unread-chat {
  position: relative;
}
.mega-tab-btn.has-unread-chat::after,
.sub-tab-btn.has-unread-chat::after {
  content: '';
  position: absolute;
  top: 4px;
  right: 6px;
  width: 10px;
  height: 10px;
  background: #ef4444;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 4px rgba(239, 68, 68, 0.6);
  pointer-events: none;
}

/* 🛠️ 工具型按鈕 (管理、篩選) */
.tool-btn {
  padding: 10px 18px;
  background: white;
  border: 2px solid var(--text-main);
  border-radius: 40px; /* 完美膠囊狀 */
  font-size: 13px;
  font-weight: 900;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: var(--shadow-flat);
  white-space: nowrap;
  height: 42px;
}

.tool-btn:hover {
  transform: translate(-2px, -2px);
  box-shadow: 4px 4px 0px var(--text-main);
  background-color: var(--bg-surface);
}

.tool-btn:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0px var(--text-main);
}

.tool-btn.active {
  background: var(--color-brand);
  color: white;
  border-color: var(--text-main);
}

/* 🎨 自定義 SVG 圖示樣式 */
.nav-icon {
  width: 1.2em;
  height: 1.2em;
  vertical-align: -0.25em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  margin-right: 2px;
  flex-shrink: 0;
}

/* 🏠 自定義 Premium 下拉選單 */
.custom-dropdown { position: relative; display: inline-block; }
.dropdown-trigger {
  background: white;
  border: 2px solid var(--text-main);
  font-weight: 800;
  color: var(--text-main);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 30px;
  box-shadow: var(--shadow-flat);
  transition: all 0.2s;
  height: 42px;
}
.dropdown-trigger:hover { background: #f1f5f9; transform: translateY(-1px); box-shadow: var(--shadow-flat-lg); }
.dropdown-arrow { font-size: 9px; color: var(--text-main); transition: 0.3s; }
.custom-dropdown.open .dropdown-arrow { transform: rotate(180deg); }
.dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 220px;
  max-height: min(70vh, 420px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--bg-main);
  border: 2px solid var(--text-main);
  border-radius: 16px;
  box-shadow: 4px 4px 0px rgba(0,0,0,0.1);
  z-index: 2000;
  padding: 6px;
  animation: dropdownFadeIn 0.2s ease-out;
}
.custom-dropdown.open .dropdown-menu { display: block; }
.dropdown-item {
  padding: 10px 15px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  transition: 0.2s;
  display: flex; align-items: center; gap: 10px;
}
.dropdown-item:hover { background: var(--bg-surface); color: var(--color-brand); }
.dropdown-section-label {
  padding: 8px 12px 4px;
  font-size: 11px;
  font-weight: 800;
  color: #94a3b8;
  text-transform: none;
  letter-spacing: 0.02em;
}
.dropdown-section-divider {
  height: 1px;
  margin: 6px 8px;
  background: #e2e8f0;
}

/* 🔍 搜尋與工具列 */
.search-container {
  width: 100%;
  margin-bottom: 20px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
#searchInput {
  flex: 1;
  padding: 0 20px;
  height: 48px;
  font-size: 16px;
  border: 2px solid var(--text-main);
  border-radius: 14px;
  outline: none;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-flat);
  background-color: white;
  color: var(--text-main);
}
#searchInput:focus { transform: translate(-1px, -1px); box-shadow: var(--shadow-flat-lg); }
#sortSelect {
  padding: 0 15px;
  border: 2px solid var(--text-main);
  border-radius: 14px;
  font-size: 14px;
  font-weight: 700;
  outline: none;
  background: var(--bg-surface);
  cursor: pointer;
  color: var(--text-main);
  box-shadow: var(--shadow-flat);
  transition: all 0.2s ease;
  height: 48px;
}

#top-filter-drawer {
  width: 100%; clear: both; display: none;
  background: #fdf6e3; border: 2px solid var(--text-main); border-radius: 16px;
  padding: 20px; margin-bottom: 20px; box-shadow: var(--shadow-flat);
}

/* 🏷️ 篩選中心群組 */
.filter-group { margin-bottom: 12px; background: white; border-radius: 12px; border: 2px solid var(--bg-surface); overflow: hidden; }
.filter-group-title {
  font-size: 14px; font-weight: 800; color: var(--text-main); padding: 12px 15px; cursor: pointer;
  user-select: none; list-style: none; background: var(--bg-surface); transition: 0.2s;
}
.filter-group-title:hover { background: #ede6d9; }
.filter-group-title::after { content: '▼'; float: right; font-size: 10px; transition: 0.3s; }
.filter-group[open] .filter-group-title::after { transform: rotate(180deg); }
.filter-group[open] .filter-group-title { border-bottom: 2px solid var(--bg-surface); }
.filter-group-content { padding: 15px; }
.filter-group-tags { display: flex; flex-wrap: wrap; gap: 8px; }

.filter-tag {
  display: inline-block; padding: 6px 14px; background: white; border: 2px solid var(--bg-surface); border-radius: 20px;
  font-size: 13px; font-weight: 700; color: var(--text-main); cursor: pointer; transition: 0.2s;
}
.filter-tag:hover { background: var(--bg-surface); transform: translateY(-1px); }
.filter-tag.active-filter {
  background: var(--color-brand) !important; color: white !important; border-color: var(--text-main) !important;
  box-shadow: 2px 2px 0px var(--text-main); transform: translateY(-1px);
}
.incoming-tag { border-color: #f59e0b; color: #b45309; background: #fffbeb; }

/* 📝 表單與輸入 */
.form-group { margin-bottom: 15px; }
.form-label { display: block; font-size: 14px; font-weight: 800; margin-bottom: 8px; color: var(--text-main); }
.form-input {
  width: 100%; padding: 12px; border: 2px solid var(--bg-surface); border-radius: 12px;
  font-size: 15px; outline: none; transition: 0.2s; background: white;
}
.form-input:focus { border-color: var(--color-brand); box-shadow: 0 0 0 3px rgba(31, 90, 133, 0.1); }
.form-textarea { min-height: 100px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 15px; }
.full-width { grid-column: span 2; }

/* ⭐ 評分星星 */
.star { transition: 0.2s; user-select: none; }
.star:hover { transform: scale(1.2); }
.star.active { color: #f59e0b !important; }

/* 🔘 彈窗按鈕 */
.modal-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 25px; }
.cancel-btn, .save-btn {
  padding: 12px 24px; border-radius: 12px; border: 2px solid var(--text-main);
  font-weight: 800; cursor: pointer; transition: 0.2s; box-shadow: var(--shadow-flat);
}
.cancel-btn { background: #e2e8f0; color: #475569; }
.cancel-btn:hover { background: #cbd5e1; transform: translate(-1px, -1px); box-shadow: var(--shadow-flat-lg); }
.save-btn { background: var(--color-brand); color: white; }
.save-btn:hover { background: var(--primary-hover); transform: translate(-1px, -1px); box-shadow: var(--shadow-flat-lg); }

.price-tag { display: none !important; background: #e0f2fe; color: #0369a1; border: 1.5px solid #0ea5e9; padding: 2px 8px; border-radius: 6px; font-weight: 800; font-size: 11px; align-items: center; gap: 4px; }
.admin-only-tag { display: none !important; background: #fef2f2; color: #991b1b; border: 1.5px solid #fecaca; padding: 2px 8px; border-radius: 6px; font-weight: 800; font-size: 11px; align-items: center; gap: 4px; }
body.admin-mode .price-tag, body.admin-mode .admin-only-tag { display: inline-flex !important; }
.market-price-undetermined {
  color: #c2410c; background: #fff7ed; border: 1px dashed #fdba74;
  padding: 2px 8px; border-radius: 6px; font-weight: bold; font-size: 12px; cursor: pointer;
}
.market-price-undetermined:hover { background: #ffedd5; }
.price-tag-undetermined {
  background: #fff7ed !important; color: #c2410c !important; border: 1.5px dashed #fdba74 !important;
  cursor: pointer; text-decoration: underline; text-underline-offset: 2px;
}
.price-tag-undetermined:hover { background: #ffedd5 !important; }

/* 聚落價格標籤：市價 / 售價 / 租 分流 */
.inv-market-tag {
  background: #f1f5f9 !important;
  color: #334155 !important;
  border: 1.5px solid #94a3b8 !important;
}
.inv-buy-tag {
  background: #e0f2fe !important;
  color: #0369a1 !important;
  border: 1.5px solid #0ea5e9 !important;
}
.inv-sell-tag {
  background: #faf5ff !important;
  color: #6d28d9 !important;
  border: 1.5px solid #c4b5fd !important;
}
.inv-rent-tag {
  background: #f0fdf4 !important;
  color: #15803d !important;
  border: 1.5px solid #86efac !important;
}
.inv-market-tag.price-tag-undetermined { text-decoration: underline; text-underline-offset: 2px; }

.external-share-btn {
  background: #f8fafc;
  color: #475569;
  border: 1.5px solid #cbd5e1;
  padding: 3px 9px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
  font-size: 11px;
  line-height: 1.2;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}
.external-share-btn:hover { background: #eff6ff; color: #1d4ed8; border-color: #93c5fd; }
.game-item-card.share-link-highlight {
  position: relative;
  z-index: 2;
  box-shadow: 0 0 0 4px #0ea5e9, 0 8px 28px rgba(14, 165, 233, 0.28) !important;
  scroll-margin-top: 80px;
  animation: share-link-pulse 1.4s ease-in-out infinite;
}
.rule-section.share-link-highlight {
  box-shadow: 0 0 0 4px #0ea5e9, 0 8px 28px rgba(14, 165, 233, 0.22) !important;
  border-radius: 16px;
  scroll-margin-top: 80px;
  animation: share-link-pulse 1.4s ease-in-out infinite;
}
@keyframes share-link-pulse {
  0%, 100% {
    box-shadow: 0 0 0 3px #0ea5e9, 0 6px 20px rgba(14, 165, 233, 0.22) !important;
  }
  50% {
    box-shadow: 0 0 0 7px #38bdf8, 0 10px 32px rgba(14, 165, 233, 0.38) !important;
  }
}
.market-card.content-focus-highlight,
div[id^="news-item-"].content-focus-highlight,
div[id^="market-item-"].content-focus-highlight {
  position: relative;
  z-index: 3;
  scroll-margin-top: 88px;
  box-shadow: 0 0 0 4px #0ea5e9, 0 10px 32px rgba(14, 165, 233, 0.32) !important;
  animation: share-link-pulse 1.4s ease-in-out infinite;
}
.content-focus-highlight.content-focus-highlight--rose {
  box-shadow: 0 0 0 4px #f43f5e, 0 10px 32px rgba(244, 63, 94, 0.28) !important;
  animation: content-focus-pulse-rose 1.4s ease-in-out infinite;
}

.market-bid-controls {
  margin-top: 15px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.market-bid-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 16px;
  outline: none;
  box-sizing: border-box;
}
.market-bid-actions {
  display: flex;
  gap: 8px;
}
.market-bid-btn {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 8px;
  font-weight: bold;
  font-size: 15px;
  cursor: pointer;
  transition: 0.2s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.market-bid-btn--custom {
  background: white;
  color: #64748b;
  border: 1px solid #cbd5e1;
}
.market-bid-btn--quick {
  background: #ef4444;
  color: white;
  border: none;
  box-shadow: 0 4px 6px rgba(239, 68, 68, 0.2);
}

.tm-pending-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid #cbd5e1;
  border-top-color: #0ea5e9;
  border-radius: 50%;
  animation: tm-spin 0.7s linear infinite;
  vertical-align: -2px;
  margin-right: 4px;
  flex-shrink: 0;
}
@keyframes tm-spin {
  to { transform: rotate(360deg); }
}
.chat-msg-pending-status {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: #64748b;
  margin-top: 4px;
}
.village-msg-pending .chat-msg-pending-status {
  justify-content: flex-end;
}
.chat-msg-pending-fail {
  color: #ef4444;
  font-weight: bold;
}
.chat-msg-pending.is-failed .msg-text-content,
.chat-msg-pending.is-failed > div[style*="background:#dbeafe"] {
  border-color: #fca5a5 !important;
  opacity: 0.75;
}

.market-card.market-card-bid-pending {
  position: relative;
}
.market-card.market-card-bid-pending .market-bid-controls {
  pointer-events: none;
  opacity: 0.45;
}
.market-bid-pending-overlay {
  position: absolute;
  inset: 0;
  z-index: 25;
  background: rgba(241, 245, 249, 0.88);
  backdrop-filter: blur(1px);
  border-radius: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
  font-weight: bold;
  color: #475569;
  pointer-events: all;
}
.market-bid-pending-overlay.is-success {
  background: rgba(236, 253, 245, 0.92);
  color: #059669;
}
.market-bid-pending-overlay.is-error {
  background: rgba(254, 242, 242, 0.92);
  color: #dc2626;
}

@keyframes content-focus-pulse-rose {
  0%, 100% {
    box-shadow: 0 0 0 3px #f43f5e, 0 6px 20px rgba(244, 63, 94, 0.22) !important;
  }
  50% {
    box-shadow: 0 0 0 7px #fb7185, 0 10px 32px rgba(244, 63, 94, 0.38) !important;
  }
}

/* 桌遊海 · 抽抽樂 */
.sea-draw-view {
  max-width: 420px;
  margin: 0 auto;
  padding: 8px 12px 24px;
}
.sea-draw-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
}
.sea-draw-header-title {
  font-weight: 800;
  font-size: 15px;
  color: var(--text-main);
  line-height: 1.35;
}
.sea-draw-header-title small {
  display: block;
  font-weight: 600;
  font-size: 11px;
  color: #64748b;
  margin-top: 2px;
}
.sea-draw-header-stats {
  display: flex;
  gap: 10px;
  font-size: 13px;
  font-weight: 700;
  color: #0ea5e9;
  white-space: nowrap;
}
.sea-draw-stage {
  position: relative;
  height: min(72vh, 600px);
  min-height: 420px;
  margin-bottom: 16px;
}
.sea-draw-card {
  position: absolute;
  inset: 0;
  background: white;
  border: 2px solid var(--text-main);
  border-radius: 20px;
  box-shadow: var(--shadow-flat);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  touch-action: auto;
  user-select: none;
}
.sea-draw-card.sea-draw-dragging { cursor: grabbing; }
.sea-draw-swipe-zone {
  touch-action: none;
  flex: 0 0 45%;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.sea-draw-cover {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
}
.sea-draw-swipe-hint {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 4;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  padding: 8px 12px 0;
  pointer-events: none;
}
.sea-draw-fav-link,
.sea-draw-header-btn {
  border: none;
  background: #f0f9ff;
  color: #0369a1;
  font-weight: 800;
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
  border: 1.5px solid #bae6fd;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
}
.sea-draw-share-btn {
  background: #eff6ff;
}
.sea-draw-remain {
  color: #0ea5e9;
  font-size: 13px;
  font-weight: 700;
}
.sea-draw-card-back {
  transform: scale(0.96) translateY(8px);
  opacity: 0.55;
  z-index: 1;
  pointer-events: none;
  filter: saturate(0.85);
}
#sea-draw-active-card { z-index: 2; touch-action: none; }
.sea-draw-card-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #f1f5f9;
  display: block;
  pointer-events: none;
  -webkit-user-drag: none;
  user-select: none;
}
.sea-draw-img-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
}
.sea-draw-img-fallback .icon-svg {
  width: 64px;
  height: 64px;
  stroke: #94a3b8;
}
.sea-draw-btn-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.sea-draw-title-row .icon-svg {
  width: 18px;
  height: 18px;
}
.sea-draw-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.sea-draw-meta .icon-svg {
  width: 14px;
  height: 14px;
}
.sea-draw-header-btn .icon-svg {
  width: 14px;
  height: 14px;
}
.sea-draw-ctrl-btn .icon-svg {
  width: 28px;
  height: 28px;
  margin: 0;
}
.sea-draw-empty-icon {
  margin-bottom: 12px;
}
.sea-draw-empty-icon .icon-svg {
  width: 48px;
  height: 48px;
  stroke: #0ea5e9;
}
.sea-draw-card-body {
  padding: 12px 16px 14px;
  overflow: hidden;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  touch-action: none;
}
.sea-draw-card-title {
  margin: 0;
  font-size: 20px;
  line-height: 1.25;
  font-weight: 900;
  flex-shrink: 0;
}
.sea-draw-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: #475569;
}
.sea-draw-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.sea-draw-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eff6ff;
  color: #0369a1;
  border: 1px solid #bae6fd;
}
.sea-draw-desc {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  color: #334155;
  white-space: pre-wrap;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.sea-draw-save-pending-overlay {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.82);
  border-radius: 20px;
  font-weight: 800;
  font-size: 14px;
  color: #334155;
  pointer-events: all;
}
.sea-draw-save-pending-overlay.is-success { color: #059669; }
.sea-draw-save-pending-overlay.is-error { color: #dc2626; }
.sea-draw-card-actions {
  display: none;
}
.sea-draw-detail-btn {
  flex: 1;
  border: 2px solid var(--text-main);
  border-radius: 12px;
  padding: 8px 10px;
  font-weight: 800;
  font-size: 12px;
  cursor: pointer;
  background: #f8fafc;
  box-shadow: var(--shadow-flat);
}
.sea-draw-save-btn { background: #fff7ed; color: #c2410c; }
.sea-draw-card-stamp {
  position: absolute;
  top: 24px;
  padding: 6px 14px;
  border: 3px solid;
  border-radius: 8px;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 2px;
  opacity: 0;
  z-index: 5;
  pointer-events: none;
  transition: opacity 0.12s;
}
.sea-draw-stamp-like {
  right: 18px;
  color: #10b981;
  border-color: #10b981;
  transform: rotate(12deg);
}
.sea-draw-stamp-skip {
  left: 18px;
  color: #ef4444;
  border-color: #ef4444;
  transform: rotate(-12deg);
}
.sea-draw-card.sea-draw-toward-like .sea-draw-stamp-like { opacity: 0.95; }
.sea-draw-card.sea-draw-toward-skip .sea-draw-stamp-skip { opacity: 0.95; }
.sea-draw-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 28px;
  margin-bottom: 10px;
}
.sea-draw-ctrl-btn {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 2px solid var(--text-main);
  background: white;
  box-shadow: var(--shadow-flat);
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s;
}
.sea-draw-ctrl-btn:active { transform: scale(0.94); }
.sea-draw-ctrl-btn.skip { color: #ef4444; }
.sea-draw-ctrl-btn.like { color: #10b981; }
.sea-draw-footer { text-align: center; }
.sea-draw-toolbar-btn {
  border: 2px solid var(--text-main);
  border-radius: 12px;
  padding: 8px 14px;
  font-weight: 800;
  font-size: 12px;
  cursor: pointer;
  background: white;
  box-shadow: var(--shadow-flat);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.sea-draw-toolbar-btn .icon-svg {
  width: 14px;
  height: 14px;
}
.sea-draw-toolbar-btn.primary { background: #0ea5e9; color: white; }
.sea-draw-empty {
  text-align: center;
  padding: 48px 16px;
  color: #64748b;
  font-weight: 700;
}
body.sea-tab-active.sea-draw-active #quick-nav-sidebar { display: none !important; }
body.sea-tab-active.sea-draw-active:not(.sidebar-collapsed) { padding-left: 0 !important; }
body.sea-tab-active.sea-draw-active #top-filter-drawer,
body.sea-tab-active.sea-draw-active #sea-count-bar,
body.sea-tab-active.sea-draw-active #sea-admin-toolbar,
body.sea-tab-active.sea-draw-active #bulk-edit-panel,
body.sea-tab-active.sea-draw-active #external-ad-strip {
  display: none !important;
}
body.sea-tab-active.sea-draw-active .search-container {
  justify-content: center;
  margin-bottom: 8px;
}
#sea-draw-active-card {
  cursor: grab;
  touch-action: pan-y;
}
#sea-draw-active-card.sea-draw-dragging {
  cursor: grabbing;
  touch-action: none;
}
#sea-draw-active-card.sea-draw-dragging .sea-draw-card-body {
  overflow: hidden;
  pointer-events: none;
}

.market-price-browse-panel {
  padding: 14px; border: 1px solid #cbd5e1; border-radius: 12px; background: #f8fafc;
}
.market-price-source-cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px;
}
.market-price-source-card {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  padding: 14px 10px; border: 1.5px solid #bfdbfe; border-radius: 12px; background: white;
  cursor: pointer; font-size: 13px; font-weight: bold; color: #2563eb; transition: 0.15s;
}
.market-price-source-card:hover { background: #eff6ff; border-color: #60a5fa; }
.market-price-source-card.is-active {
  background: #2563eb; color: white; border-color: #2563eb; box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}
.market-price-source-card small { font-size: 11px; font-weight: normal; opacity: 0.85; }
.market-price-mini-btn {
  border: 1px solid #bfdbfe; background: #eff6ff; color: #2563eb; border-radius: 8px;
  padding: 6px 10px; font-size: 12px; font-weight: bold; cursor: pointer;
}
.market-price-mini-btn:hover { background: #dbeafe; }
.market-price-results-panel {
  margin-bottom: 10px; padding: 10px 12px; background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 12px;
}
.market-price-candidates-list { display: flex; flex-direction: column; gap: 6px; max-height: 120px; overflow-y: auto; }
.market-price-candidate-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 10px; background: white; border: 1px solid #e2e8f0; border-radius: 8px; cursor: pointer; font-size: 13px;
}
.market-price-candidate-item:hover { border-color: #93c5fd; background: #f0f9ff; }
.market-price-candidate-item.is-active { border-color: #2563eb; background: #eff6ff; box-shadow: 0 0 0 1px #2563eb; }
.market-price-candidate-item small { color: #94a3b8; white-space: nowrap; }
.market-price-candidate-price { color: #0369a1; font-weight: 800; white-space: nowrap; }
.market-price-quick-dock {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  z-index: 50000;
  padding: 0 10px;
  pointer-events: auto;
}
.market-price-quick-dock.is-visible {
  display: block;
  animation: marketPriceDockIn 0.22s ease;
}
@keyframes marketPriceDockIn {
  from { transform: translateY(16px); opacity: 0.4; }
  to { transform: translateY(0); opacity: 1; }
}
.market-price-quick-dock.is-highlight .market-price-quick-dock-inner {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.45), 0 -6px 28px rgba(15, 23, 42, 0.22);
}
.market-price-quick-dock-inner {
  max-width: 760px;
  margin: 0 auto;
  padding: 10px 12px;
  background: #fff;
  border: 2px solid #334155;
  border-radius: 14px;
  box-shadow: 0 -6px 28px rgba(15, 23, 42, 0.22);
}
.market-price-dock-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.market-price-dock-title {
  font-size: 14px;
  color: #1e3a8a;
}
.market-price-dock-hint {
  font-size: 12px;
  color: #64748b;
}
.market-price-dock-game {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 12px;
  font-weight: bold;
  color: #334155;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: right;
}
.market-price-dock-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.market-price-dock-input {
  flex: 1 1 120px;
  min-width: 0;
  padding: 11px 12px;
  border: 2px solid #93c5fd;
  border-radius: 10px;
  font-size: 18px;
  font-weight: bold;
  box-sizing: border-box;
  background: #f8fafc;
  color: #0f172a;
}
.market-price-dock-input.market-price-input-highlight {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(147, 197, 253, 0.85);
  background: #fff;
}
.market-price-dock-shopee {
  flex-shrink: 0;
  padding: 10px 12px;
  border: 1.5px solid #fb923c;
  background: #fff7ed;
  color: #c2410c;
  border-radius: 10px;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
}
.market-price-dock-shopee:hover { background: #ffedd5; }
.market-price-dock-save {
  flex-shrink: 0;
  padding: 10px 14px;
  border: none;
  background: #2563eb;
  color: white;
  border-radius: 10px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
}
.market-price-dock-save:disabled { opacity: 0.6; cursor: wait; }
.market-price-dock-close {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: none;
  background: #f1f5f9;
  color: #64748b;
  border-radius: 10px;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
body.has-market-price-dock { padding-bottom: 120px; }
@media (max-width: 800px) {
  .market-price-quick-dock {
    bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  }
  body.has-market-price-dock {
    padding-bottom: calc(150px + env(safe-area-inset-bottom, 0px));
  }
  .market-price-dock-row { flex-wrap: wrap; }
  .market-price-dock-input { flex: 1 1 100%; min-width: 100%; }
  .market-price-dock-shopee,
  .market-price-dock-save { flex: 1; }
}
#market-price-lookup-modal.is-manual-quick {
  align-items: flex-end;
  justify-content: center;
  background: rgba(15, 23, 42, 0.4);
  padding: 0;
}
#market-price-lookup-modal.is-manual-quick .market-price-lookup-content {
  max-width: 520px;
  width: 100%;
  margin: 0;
  border-radius: 20px 20px 0 0;
  max-height: none;
  box-shadow: 0 -8px 32px rgba(15, 23, 42, 0.2);
  animation: marketPriceSheetUp 0.28s ease;
}
#market-price-lookup-modal.is-return-focus .market-price-lookup-content {
  animation: marketPriceSheetPulse 0.55s ease;
}
@keyframes marketPriceSheetUp {
  from { transform: translateY(100%); opacity: 0.6; }
  to { transform: translateY(0); opacity: 1; }
}
@keyframes marketPriceSheetPulse {
  0%, 100% { box-shadow: 0 -8px 32px rgba(15, 23, 42, 0.2); }
  50% { box-shadow: 0 -8px 32px rgba(37, 99, 235, 0.45), 0 0 0 3px rgba(147, 197, 253, 0.9); }
}
.market-price-quick-steps {
  display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px;
}
.market-price-step {
  font-size: 11px; font-weight: bold; padding: 4px 8px; border-radius: 999px;
  background: #f1f5f9; color: #64748b; border: 1px solid #e2e8f0;
}
.market-price-step.is-done { background: #ecfdf5; color: #166534; border-color: #86efac; }
.market-price-step.is-current { background: #eff6ff; color: #1d4ed8; border-color: #93c5fd; }
.market-price-quick-tip {
  margin: 0 0 10px; font-size: 13px; line-height: 1.5; color: #475569;
}
.market-price-shopee-btn {
  width: 100%; padding: 10px 14px; margin-bottom: 12px;
  border: 1.5px solid #fb923c; background: #fff7ed; color: #c2410c;
  border-radius: 10px; font-size: 14px; font-weight: bold; cursor: pointer;
}
.market-price-shopee-btn:hover { background: #ffedd5; }
#market-price-lookup-input.market-price-input-highlight {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(147, 197, 253, 0.85);
}
.exp-stock-tag { background: #f0fdf4; color: #166534; border: 1.5px solid #bbf7d0; padding: 2px 8px; border-radius: 6px; font-weight: 800; font-size: 11px; display: inline-flex; align-items: center; gap: 4px; }
.exp-incoming-tag { background: #fffbeb; color: #92400e; border: 1.5px solid #fef3c7; padding: 2px 8px; border-radius: 6px; font-weight: 800; font-size: 11px; display: inline-flex; align-items: center; gap: 4px; }

#top-filter-drawer { width: 100%; clear: both; }

/* 📦 遊戲清單與卡片佈局 */
#bulk-action-bar {
  display: none; background: #fffbeb; border: 2px solid #f59e0b; border-radius: 14px;
  padding: 12px 15px; margin-bottom: 20px; box-shadow: var(--shadow-flat);
}
.bulk-tools-row { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.bulk-tools-row select, .bulk-tools-row input {
  padding: 8px 12px; border: 2px solid var(--text-main); border-radius: 10px; outline: none; font-size: 13px;
}

.game-list-container { width: 100%; display: flex; flex-direction: column; gap: 20px; }
.game-item-card {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 20px;
  border: 2px solid var(--text-main);
  box-shadow: var(--shadow-flat);
  cursor: pointer;
  transition: all 0.2s;
  overflow: hidden;
  position: relative;
}
.game-item-card:hover { transform: translate(-2px, -2px); box-shadow: var(--shadow-flat-lg); }
.inv-card-layout { display: flex; gap: 15px; align-items: flex-start; }
.game-thumb { width: 80px; height: 80px; border-radius: 12px; object-fit: cover; border: 2px solid var(--text-main); flex-shrink: 0; }
.game-info-wrapper { flex: 1; min-width: 0; }
.game-item-title {
  font-size: 19px; font-weight: 900; margin-bottom: 8px; color: var(--text-main);
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
}
.game-item-title .admin-only-btn {
  margin-left: 0; padding: 4px 10px; font-size: 12px; border-radius: 10px;
}
.game-item-title .external-share-btn {
  padding: 4px 10px; font-size: 12px; border-radius: 10px;
  border: 2px solid var(--text-main); font-weight: bold; box-shadow: var(--shadow-flat);
}
.inv-meta { font-size: 13px; color: var(--text-main); margin-top: 8px; display: flex; gap: 8px; flex-wrap: wrap; }
.inv-meta span { background: var(--bg-surface); padding: 4px 12px; border-radius: 20px; border: 1.5px solid var(--text-main); font-weight: 700; display: inline-flex; align-items: center; gap: 4px; }

.grid-full-width { grid-column: 1 / -1; }
.card-checkbox { 
  position: absolute; top: 10px; left: 10px; z-index: 10; 
  width: 20px; height: 20px; cursor: pointer;
}

/* 🖼️ 高密度卡片模式 */
.game-list-container.card-mode { display: grid; grid-template-columns: repeat(var(--card-cols, 6), minmax(0, 1fr)); gap: 12px; }
.card-mode .game-item-card { padding: 0; border-radius: 12px; display: flex; flex-direction: column; }
.card-mode .inv-card-layout { display: flex; flex-direction: column; gap: 0; flex: 1; }
.card-mode .game-thumb, .card-mode .game-thumb-placeholder { 
  width: 100%; aspect-ratio: 1/1; height: auto; border: none; 
  border-bottom: 2px solid var(--text-main); border-radius: 0; 
}
.card-mode .game-thumb-placeholder {
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-surface); font-size: 32px;
}
.card-mode .game-info-wrapper { padding: 10px; display: flex; flex-direction: column; flex: 1; }
.card-mode .game-item-title { 
  font-size: 14px; min-height: auto; line-height: 1.3;
  padding-right: 0 !important; margin-bottom: 5px;
  display: flex; flex-direction: column; gap: 4px; align-items: stretch;
}
.card-mode .game-card-name {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; line-height: 1.3;
}
.card-mode .game-card-title-actions {
  display: flex; flex-wrap: wrap; gap: 4px; align-items: center;
}
.card-mode .inv-meta { gap: 4px; }
.card-mode .inv-meta span { padding: 2px 6px; font-size: 11px; border-radius: 6px; }
.game-card-expand-hint {
  display: none;
  width: 100%; margin-top: 6px; padding: 4px 8px;
  background: var(--bg-surface); border: 1.5px dashed var(--text-muted, #94a3b8);
  border-radius: 8px; font-size: 11px; font-weight: 700; color: var(--text-muted, #64748b);
  cursor: pointer; text-align: center;
}
.game-card-expand-hint:hover { background: #f1f5f9; color: var(--text-main); }
@media (min-width: 801px) {
  .game-list-container.card-mode .game-card-expand-hint { display: block; }
  .game-list-container.card-mode .game-item-card:not(.is-card-expanded) .game-card-details { display: none; }
  .game-list-container.card-mode .game-item-card.is-card-expanded .game-card-details { display: block; }
  .game-list-container:not(.card-mode) .game-card-expand-hint { display: none !important; }
  .game-list-container:not(.card-mode) .game-card-details { display: block; }
}

/* 📖 規則與其他 */
.view-section { display: none; }
.view-section.active { display: block; }

.page-toc { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; padding-bottom: 10px; }
.page-toc-btn {
  background: white; border: 2px solid var(--text-main); padding: 8px 16px; border-radius: 12px;
  font-size: 13px; font-weight: 700; cursor: pointer; color: var(--text-main); transition: all 0.2s;
  box-shadow: var(--shadow-flat);
}
.page-toc-btn:hover { background: var(--bg-surface); transform: translate(-1px, -1px); box-shadow: var(--shadow-flat-lg); }

.rule-section { background: white; border-radius: 16px; padding: 25px; margin-bottom: 25px; border: 2px solid var(--text-main); box-shadow: var(--shadow-flat); }
.rule-section-title {
  font-size: 20px; font-weight: 900; border-bottom: 2px solid var(--bg-surface); padding-bottom: 12px;
  margin-top: 0; margin-bottom: 20px; color: var(--text-main); display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap;
}
.rule-section-title.expansion-title { background: #fffcf0; border-left: 5px solid #f59e0b; padding: 10px 15px; border-radius: 8px; color: #b45309; }

details.inner-fold { margin-bottom: 12px; border: 2px solid var(--bg-surface); border-radius: 12px; background: white; transition: 0.3s; }
details.inner-fold[open] { border-color: var(--text-main); box-shadow: var(--shadow-flat); }
summary.inner-summary { padding: 14px; font-weight: 800; cursor: pointer; list-style: none; display: flex; align-items: center; color: var(--text-main); gap: 8px; }
summary.inner-summary::-webkit-details-marker { display: none; }
summary.inner-summary::before {
  content: '';
  display: inline-block;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  background: currentColor;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='9 18 15 12 9 6'/%3E%3C/svg%3E") center / contain no-repeat;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='9 18 15 12 9 6'/%3E%3C/svg%3E") center / contain no-repeat;
  transition: transform 0.2s;
}
details[open]>summary.inner-summary::before { transform: rotate(90deg); }

.expand-all-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  color: #0369a1;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
}
.expand-all-btn:hover { background: #e0f2fe; }
.level-2 .expand-all-btn,
.level-3 .expand-all-btn { font-size: 11px; padding: 3px 8px; }

.rule-external-links-section { margin-top: 40px; text-align: center; }
.rule-external-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-bottom: 16px; }
.rule-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 12px;
  border: 2px solid var(--text-main);
  background: #fff;
  color: var(--text-main);
  font-weight: 800;
  text-decoration: none;
  box-shadow: var(--shadow-flat);
  transition: 0.2s;
}
.rule-link-btn:hover { transform: translateY(-1px); background: #f8fafc; }
.rule-external-video { max-width: 720px; margin: 20px auto 0; text-align: left; }
.rule-external-video__title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 800;
  color: #334155;
  margin-bottom: 8px;
}
.rule-external-video__embed { border-radius: 12px; overflow: hidden; }

.rule-external-links-list { display: flex; flex-direction: column; gap: 10px; }
.rule-external-link-row {
  display: grid;
  grid-template-columns: minmax(100px, 140px) 1fr auto auto;
  gap: 8px;
  align-items: center;
}
.rule-link-presets { display: flex; gap: 6px; flex-wrap: wrap; }
.rule-link-preset-btn {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #334155;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.rule-link-preset-btn:hover { background: #e2e8f0; }
.rule-link-remove-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #dc2626;
  border-radius: 8px;
  cursor: pointer;
}
.rule-external-link-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1.5px dashed #94a3b8;
  background: #f8fafc;
  color: #475569;
  font-weight: 700;
  cursor: pointer;
}
@media (max-width: 640px) {
  .rule-external-link-row { grid-template-columns: 1fr; }
  .rule-link-presets { justify-content: flex-start; }
}

.level-1 { border-left: 6px solid var(--color-brand); }
.level-2 { border-left: 6px solid var(--secondary); margin: 10px 0 10px 15px; }
.level-3 { border-left: 6px solid var(--accent); margin: 10px 0 10px 15px; }
.inner-content { padding: 5px 20px 20px 45px; color: var(--text-main); }

.rule-item-list { padding-left: 20px; margin: 10px 0; }
.rule-item-list li { margin-bottom: 12px; font-size: 15px; font-weight: 500; }
.note-text { color: var(--accent); font-style: italic; font-size: 0.9em; margin-top: 10px; display: block; }

.exp-detail-card { background: #fdf6e3; border: 2px solid #fcd34d; border-radius: 16px; padding: 20px; margin-bottom: 25px; box-shadow: var(--shadow-flat); }
.exp-detail-text { font-size: 14px; color: #5d4037; line-height: 1.6; font-weight: 600; }

.exp-tags-container { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.exp-tag-wrapper { 
  border-left: 4px solid #f59e0b; 
  padding: 6px 12px; 
  background: #fffcf0; 
  border-radius: 8px; 
  border: 1px solid #fef3c7; 
  margin-bottom: 4px;
}
.exp-tag { 
  font-size: 12px; 
  font-weight: 800; 
  color: #b45309; 
  cursor: pointer;
}
.exp-desc { font-size: 11px; color: #78350f; margin-top: 4px; line-height: 1.4; opacity: 0.8; }
.exp-meta-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.hidden-exp { display: none !important; }

.exp-input-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 5px;
  align-items: center;
}
.exp-input-row input {
  flex: 1;
  min-width: 60px;
  padding: 8px 10px !important;
}
.exp-input-row input.exp-name-in { flex: 1.5; min-width: 100px; }
.exp-input-row input.exp-market-in { flex: 0.8; min-width: 70px; max-width: 90px; }
.exp-market-lookup-btn {
  flex: 0 0 auto;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 700;
  border: 1.5px solid #93c5fd;
  border-radius: 6px;
  background: #eff6ff;
  color: #2563eb;
  cursor: pointer;
}
.exp-market-lookup-btn:hover { background: #dbeafe; }
.remove-exp-btn {
  background: #ff4d4f;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  padding: 8px 10px;
  font-weight: bold;
  transition: 0.2s;
}

.show-more-btn {
  background: #f1f5f9;
  border: 1.5px solid #cbd5e1;
  color: #64748b;
  padding: 4px 12px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  margin-top: 5px;
  transition: all 0.2s;
  display: inline-block;
}
.show-more-btn:hover {
  background: #e2e8f0;
  color: #475569;
}

.exp-summary-tag { 
  background: #fdf6e3; 
  color: #b45309; 
  border: 1.5px solid #fcd34d; 
  padding: 4px 12px; 
  border-radius: 20px; 
  font-size: 11px; 
  font-weight: 800; 
  display: inline-flex; 
  align-items: center; 
  gap: 6px;
}

/* 🛡️ 管理與安全 */
.modal-overlay {
  display: none; position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
  background: rgba(0,0,0,0.6); z-index: 10000; justify-content: center; align-items: center;
  padding: 15px;
}
.modal-content {
  background: var(--bg-main); border: 2px solid var(--text-main); border-radius: 24px;
  width: 100%; max-width: 600px; max-height: 90vh; overflow-y: auto;
  box-shadow: 10px 10px 0px rgba(0,0,0,0.1); position: relative;
  padding: 30px; box-sizing: border-box;
}
.modal-body {
  padding: 10px 5px;
  box-sizing: border-box;
}
.global-admin-menu-box {
  margin: 4px 0 2px;
  padding: 12px;
  border-radius: 14px;
  border: 1.5px solid #e0e7ff;
  background: linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%);
  text-align: left;
}
.global-admin-menu-box__title {
  font-size: 11px;
  font-weight: 800;
  color: #6366f1;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}
.global-admin-menu-box__actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.global-admin-menu-box .menu-item-btn {
  width: 100%;
  justify-content: flex-start;
}
.custom-dialog-overlay {
  display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.7); z-index: 30000; justify-content: center; align-items: center;
  backdrop-filter: blur(8px);
}
.custom-dialog {
  background: white; padding: 30px; border-radius: 20px; border: 2px solid var(--text-main);
  max-width: 400px; width: 90%; text-align: center; box-shadow: var(--shadow-flat-lg);
}

.admin-only-btn {
  display: none !important; font-size: 13px; padding: 6px 12px; margin-left: 10px; cursor: pointer;
  border-radius: 8px; border: 2px solid var(--text-main); font-weight: 900;
  box-shadow: var(--shadow-flat); transition: all 0.2s;
  align-items: center; gap: 4px;
}
/* 編輯彈窗工具列（JSON／AI）：有權限即顯示，不需開啟編輯模式 */
.modal-admin-tool-btn {
  display: none !important;
  font-size: 13px; padding: 6px 12px; margin-left: 0; cursor: pointer;
  border-radius: 8px; border: 2px solid var(--text-main); font-weight: 900;
  box-shadow: var(--shadow-flat); transition: all 0.2s;
  align-items: center; gap: 4px;
}
body.admin-mode #inv-modal .modal-admin-tool-btn,
body.global-admin-mode #inv-modal .modal-admin-tool-btn,
body.global-admin-mode #sea-add-modal .modal-admin-tool-btn,
body.global-admin-mode #add-modal .modal-admin-tool-btn {
  display: inline-flex !important;
}
.edit-btn { background: #ffc107; color: var(--text-main); }
.delete-btn { background: #ef4444; color: white; }
.sea-import-btn { background: #e0f2fe; color: #0369a1; border-color: #bae6fd; }

/* 聚落管理員：僅編輯模式顯示編輯／刪除 */
body.edit-mode.admin-mode .admin-only-btn { display: inline-flex !important; }

/* 全域管理員：桌遊海／規則頁僅編輯模式顯示 */
body.edit-mode.global-admin-mode.sea-tab-active .admin-only-btn,
body.edit-mode.global-admin-mode #game-view .admin-only-btn { display: inline-flex !important; }

/* 🚀 只有在管理員權限時才顯示「遙控器子功能」中的管理區塊 */
body.admin-mode .admin-only-block { display: flex !important; }

/* 🌊 全域管理員：桌遊海管理工具列與懸浮選單 */
body.global-admin-mode.sea-tab-active #sea-admin-toolbar,
body.global-admin-mode.sea-tab-active #sea-admin-menu-container {
  display: flex !important;
}

/* 🛠️ 編輯模式視覺提示 (螢幕邊框淡淡金光) */
body.edit-mode::after {
  content: ""; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  border: 4px solid rgba(245, 158, 11, 0.3); pointer-events: none; z-index: 9999;
}

/* 📺 管理員遙控器 (Admin Remote Control) */
.remote-control-panel, .remote-control-panel * {
  box-sizing: border-box;
}

.remote-control-panel {
  position: relative;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 3px solid var(--text-main);
  border-radius: 24px;
  padding: 20px;
  box-shadow: 0 15px 35px rgba(0,0,0,0.2), var(--shadow-flat-lg);
  display: flex;
  flex-direction: column;
  gap: 15px;
  width: 280px;
  margin-bottom: 5px;
}

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

.remote-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.remote-page-indicator {
  font-size: 11px;
  color: #94a3b8;
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.remote-grid-slot {
  min-height: 0;
  aspect-ratio: 1 / 1;
}

.remote-grid-slot--empty {
  border: 2px dashed #e2e8f0;
  border-radius: 16px;
  background: #f8fafc;
}

.remote-grid-slot .remote-btn {
  width: 100%;
  height: 100%;
}

.remote-pager-nav {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  margin-top: 10px;
  padding: 0 2px;
}

.remote-pager-arrows {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.remote-pager-arrow {
  width: 36px;
  height: 36px;
  border: 2px solid var(--text-main);
  border-radius: 12px;
  background: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #475569;
  box-shadow: var(--shadow-flat);
  transition: transform 0.15s ease, background 0.15s ease;
  flex-shrink: 0;
  padding: 0;
}

.remote-pager-arrow svg {
  width: 18px;
  height: 18px;
}

.remote-pager-arrow:hover:not(:disabled) {
  transform: translateY(-1px);
  background: #f8fafc;
}

.remote-pager-arrow:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: 1px 1px 0 var(--text-main);
}

.remote-pager-arrow:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.remote-drag-hint {
  margin: 8px 0 0;
  font-size: 10px;
  color: #94a3b8;
  text-align: center;
}

body.remote-drag-active {
  user-select: none;
  -webkit-user-select: none;
}

body.remote-drag-active .remote-btn {
  pointer-events: none;
}

body.remote-drag-active .remote-btn--ghost {
  pointer-events: none;
}

.remote-btn--ghost {
  opacity: 1 !important;
  transform: scale(1.1) rotate(-2deg);
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.28), 0 4px 10px rgba(15, 23, 42, 0.12);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  cursor: grabbing;
}

.remote-btn--placeholder {
  opacity: 0.2 !important;
  transform: scale(0.9) !important;
  box-shadow: none !important;
  filter: grayscale(0.35);
}

.remote-slot--dragging {
  background: #fffbeb;
  border-radius: 16px;
}

.remote-slot--drop-target {
  outline: 4px solid #ea580c;
  outline-offset: -2px;
  border-radius: 16px;
  background: linear-gradient(145deg, #fffbeb 0%, #fde68a 100%);
  box-shadow: inset 0 0 0 2px #f59e0b, 0 0 12px rgba(245, 158, 11, 0.45);
  animation: remote-slot-drop-pulse 0.55s ease-in-out infinite alternate;
  z-index: 2;
}

@keyframes remote-slot-drop-pulse {
  from {
    outline-color: #f59e0b;
    box-shadow: inset 0 0 0 2px #fbbf24, 0 0 8px rgba(245, 158, 11, 0.35);
  }
  to {
    outline-color: #ea580c;
    box-shadow: inset 0 0 0 3px #f59e0b, 0 0 16px rgba(234, 88, 12, 0.5);
  }
}

#remote-grid-pager {
  position: relative;
}

.remote-control-panel.remote-edge-prev::before,
.remote-control-panel.remote-edge-next::after {
  content: '‹';
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 800;
  color: #b45309;
  pointer-events: none;
  z-index: 12;
  border-radius: 10px;
  border: 2px solid #f59e0b;
  background: rgba(255, 251, 235, 0.95);
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.35);
  animation: remote-edge-pulse 0.8s ease-in-out infinite alternate;
}

.remote-control-panel.remote-edge-prev::before {
  right: calc(100% + 8px);
}

.remote-control-panel.remote-edge-next::after {
  content: '›';
  left: calc(100% + 8px);
}

@keyframes remote-edge-pulse {
  from { opacity: 0.7; transform: translateY(-50%) scale(0.96); }
  to { opacity: 1; transform: translateY(-50%) scale(1.04); }
}

#remote-btn-pool {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

/* 遙控器展開時置於最上層，避免被搜尋／模式切換遮蓋 */
body.village-menu-open #village-menu-container {
  z-index: 10500 !important;
}
body.village-menu-open #village-sub-buttons .remote-control-panel {
  max-height: min(68vh, calc(100dvh - 200px));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.28);
}

/* 商家模式：營業時間與時段價位 */
.home-merchant-subnav {
  margin-bottom: 16px;
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 12px !important;
}

.member-center-content {
  text-align: center;
}

.merchant-pinned-item {
  border: 2px solid #fbbf24 !important;
  box-shadow: 0 4px 12px rgba(251, 191, 36, 0.22) !important;
}

.merchant-section-title {
  font-size: 13px;
  font-weight: 800;
  color: #334155;
  margin-bottom: 8px;
}

.merchant-pricing-hint {
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
}

.merchant-block-hint {
  font-size: 11px;
  color: #92400e;
  margin: 0 0 10px;
  line-height: 1.45;
}

.merchant-rule-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 10px;
}

.merchant-rule-card {
  background: white;
  border: 1px solid #fcd34d;
  border-radius: 12px;
  padding: 10px;
}

.merchant-pricing-block .merchant-rule-card {
  border-color: #e2e8f0;
}

.merchant-rule-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.merchant-rule-card-title {
  font-size: 12px;
  font-weight: 800;
  color: #78350f;
}

.merchant-pricing-block .merchant-rule-card-title {
  color: #334155;
}

.merchant-rule-remove {
  border: none;
  background: #fee2e2;
  color: #b91c1c;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  cursor: pointer;
}

.merchant-add-btn {
  width: 100%;
  border: 2px dashed #fbbf24;
  background: white;
  color: #b45309;
  border-radius: 10px;
  padding: 8px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  margin-bottom: 10px;
}

.merchant-add-btn:hover {
  background: #fffbeb;
}

.merchant-add-btn--pricing {
  border-color: #cbd5e1;
  color: #475569;
}

.merchant-add-btn--pricing:hover {
  background: #f8fafc;
}

.merchant-ticket-pick-card {
  display: block;
  width: 100%;
  text-align: left;
  background: #fffbeb;
  border: 2px solid #fde68a;
  border-radius: 14px;
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
}

.merchant-ticket-pick-card:hover:not(.is-disabled):not(:disabled) {
  border-color: #f59e0b;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.15);
  transform: translateY(-1px);
}

.merchant-ticket-pick-card.is-disabled,
.merchant-ticket-pick-card:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  background: #f8fafc;
  border-color: #e2e8f0;
}

.merchant-ticket-pick-name {
  font-size: 15px;
  font-weight: 800;
  color: #b45309;
  margin-bottom: 4px;
}

.merchant-ticket-pick-desc {
  font-size: 12px;
  color: #64748b;
  line-height: 1.45;
  margin-bottom: 8px;
}

.merchant-ticket-pick-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  font-size: 11px;
  color: #475569;
  font-weight: 600;
}

.merchant-scan-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 14px;
}

.merchant-scan-box-title {
  font-size: 12px;
  font-weight: 800;
  color: #334155;
  margin-bottom: 8px;
}

.merchant-member-empty-hint {
  color: #94a3b8;
  font-size: 13px;
  text-align: center;
  padding: 24px 12px;
  line-height: 1.6;
  background: #f8fafc;
  border: 1px dashed #e2e8f0;
  border-radius: 12px;
}

.merchant-member-detail-header {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 1px solid #fde68a;
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 12px;
}

.merchant-member-detail-name {
  font-size: 18px;
  font-weight: 900;
  color: #b45309;
  margin-bottom: 6px;
}

.merchant-member-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  font-size: 12px;
  color: #475569;
}

.merchant-member-detail-uid {
  font-size: 10px;
  color: #94a3b8;
  margin-top: 8px;
  word-break: break-all;
}

.merchant-member-section {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 12px;
}

.merchant-member-section-title {
  font-size: 12px;
  font-weight: 800;
  color: #334155;
  margin-bottom: 10px;
}

.merchant-points-adjust-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-top: 10px;
}

.merchant-member-section--compact {
  padding: 10px 12px;
  margin-bottom: 10px;
}

.merchant-points-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
}

.merchant-points-current {
  font-size: 13px;
  color: #475569;
  white-space: nowrap;
}

.merchant-points-current b {
  color: #f59e0b;
  font-size: 16px;
}

.merchant-points-adjust-row--compact {
  margin-top: 0;
  flex: 1;
  flex-wrap: nowrap;
  min-width: 0;
}

.merchant-pts-btn {
  flex: 0 0 auto;
  min-width: 36px;
  padding: 5px 6px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid #fde68a;
  border-radius: 8px;
  background: #fffbeb;
  color: #b45309;
  cursor: pointer;
}

.merchant-pts-btn:hover {
  background: #fef3c7;
}

.merchant-pts-input {
  width: 52px !important;
  min-width: 52px !important;
  flex: 0 0 52px;
  padding: 5px 4px !important;
  font-size: 13px;
  text-align: center;
  box-sizing: border-box;
}

.merchant-pts-apply-btn {
  flex: 0 0 auto;
  padding: 5px 12px !important;
  font-size: 12px;
  white-space: nowrap;
  width: auto !important;
  margin: 0 !important;
}

.merchant-members-modal-content {
  min-width: 360px;
}

.merchant-member-ticket-card {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 10px;
  padding: 10px 12px;
  margin-top: 8px;
}

.merchant-member-ticket-card.is-inactive {
  background: #f8fafc;
  border-color: #e2e8f0;
  opacity: 0.85;
}

.merchant-member-ticket-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.merchant-member-ticket-name {
  font-size: 13px;
  font-weight: 800;
  color: #b45309;
}

.merchant-member-ticket-serial {
  color: #64748b;
  font-weight: 600;
}

.merchant-member-ticket-status {
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.merchant-member-ticket-code {
  font-family: ui-monospace, monospace;
  font-size: 12px;
  color: #475569;
  margin-top: 6px;
  letter-spacing: 0.5px;
}

.merchant-member-ticket-until {
  font-size: 10px;
  color: #94a3b8;
  margin-top: 4px;
}

.merchant-member-ticket-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.merchant-pricing-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}

.merchant-pricing-row--3 {
  grid-template-columns: 1fr 1fr 1fr;
}

.merchant-field-label {
  display: block;
  font-size: 10px;
  color: #64748b;
  font-weight: 700;
  margin-bottom: 3px;
}

.merchant-daytype-select {
  width: 100%;
  padding: 8px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  box-sizing: border-box;
  background: white;
}

.merchant-schedule-block,
.merchant-pricing-block {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 12px;
  padding: 12px;
}

.merchant-pricing-block {
  background: #f8fafc;
  border-color: #e2e8f0;
}

.merchant-preset-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.merchant-preset-label {
  font-size: 11px;
  color: #92400e;
  font-weight: 700;
}

.merchant-preset-btn {
  border: 1px solid #fcd34d;
  background: white;
  color: #b45309;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.merchant-preset-btn:hover {
  background: #fef3c7;
}

.merchant-weekday-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.merchant-day-btn {
  min-width: 36px;
  height: 36px;
  border: 2px solid #fcd34d;
  border-radius: 10px;
  background: white;
  color: #92400e;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.merchant-day-btn.is-active {
  background: #f59e0b;
  border-color: #d97706;
  color: white;
}

.merchant-time-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-bottom: 10px;
}

.merchant-time-field {
  flex: 1;
  min-width: 0;
}

.merchant-time-label {
  display: block;
  font-size: 11px;
  color: #92400e;
  font-weight: 700;
  margin-bottom: 3px;
}

.merchant-time-input {
  width: 100%;
  margin: 0;
  box-sizing: border-box;
  padding: 8px;
  font-size: 14px;
}

.merchant-time-sep {
  font-size: 12px;
  color: #b45309;
  font-weight: 700;
  padding-bottom: 10px;
}

.merchant-holiday-opts {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}

.merchant-check-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #78350f;
  font-weight: 600;
  cursor: pointer;
}

.merchant-hours-preview {
  font-size: 12px;
  color: #065f46;
  background: #ecfdf5;
  border: 1px dashed #6ee7b7;
  border-radius: 8px;
  padding: 8px 10px;
  line-height: 1.5;
}

.merchant-price-tier {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 8px;
}

.merchant-price-tier:last-child {
  margin-bottom: 0;
}

.merchant-price-tier.is-disabled {
  opacity: 0.55;
}

.merchant-price-tier-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
}

.merchant-price-tier-label {
  font-size: 13px;
  font-weight: 800;
  color: #334155;
}

.merchant-price-tier-time {
  font-size: 11px;
  color: #64748b;
  font-weight: 600;
  text-align: right;
}

.merchant-price-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.merchant-price-input {
  flex: 1;
  margin: 0;
  box-sizing: border-box;
  min-width: 0;
}

.merchant-price-unit {
  font-size: 11px;
  color: #94a3b8;
  white-space: nowrap;
  font-weight: 600;
}

.merchant-preview-section {
  margin-top: 16px;
  padding: 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
}

.merchant-preview-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.merchant-preview-tab {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid #cbd5e1;
  background: white;
  color: #64748b;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
}

.merchant-preview-tab.is-active {
  background: #f59e0b;
  border-color: #f59e0b;
  color: white;
}

.merchant-preview-panel {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px;
  overflow-x: auto;
}

.merchant-preview-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.merchant-preview-shop-name {
  font-size: 17px;
  font-weight: 800;
  color: #92400e;
}

.merchant-preview-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: #475569;
}

.merchant-preview-desc {
  margin: 0;
  font-size: 13px;
  color: #334155;
  line-height: 1.55;
  white-space: pre-line;
}

.merchant-preview-subtitle {
  font-size: 12px;
  font-weight: 800;
  color: #64748b;
  margin-top: 4px;
}

.merchant-preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.merchant-preview-table th,
.merchant-preview-table td {
  border: 1px solid #e2e8f0;
  padding: 8px 10px;
  text-align: left;
}

.merchant-preview-table th {
  background: #fffbeb;
  color: #92400e;
  font-weight: 800;
}

.merchant-preview-table--pricing th {
  background: #eff6ff;
  color: #1e40af;
}

.merchant-preview-empty {
  color: #94a3b8;
  font-style: italic;
}

.merchant-preview-hint {
  margin: 10px 0 0;
  font-size: 11px;
  color: #94a3b8;
  line-height: 1.4;
}

.merchant-info-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 0;
  padding-right: 36px;
}

.merchant-info-actions-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.merchant-info-icon-btn {
  width: 36px;
  height: 36px;
  border: 1px solid #fde68a;
  border-radius: 10px;
  background: #fffbeb;
  color: #b45309;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}

.merchant-info-icon-btn:hover {
  background: #fef3c7;
  border-color: #f59e0b;
  transform: translateY(-1px);
}

.merchant-info-icon-btn svg {
  width: 18px;
  height: 18px;
}

.merchant-info-download-dropdown {
  position: relative;
}

.merchant-info-download-dropdown .dropdown-menu {
  right: 0;
  left: auto;
  min-width: 148px;
  z-index: 20;
}

.merchant-week-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.merchant-week-cell {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px 6px;
  min-height: 72px;
  background: #f8fafc;
  font-size: 11px;
}

.merchant-week-cell.is-open {
  background: #fffbeb;
  border-color: #fde68a;
}

.merchant-week-day {
  font-weight: 800;
  color: #92400e;
  text-align: center;
  margin-bottom: 6px;
  font-size: 12px;
}

.merchant-week-slot {
  color: #334155;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 2px;
}

.merchant-week-national {
  display: block;
  font-size: 10px;
  color: #b45309;
  font-weight: 700;
}

.merchant-week-prices {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed #fde68a;
}

.merchant-week-price {
  color: #0369a1;
  font-size: 10px;
  line-height: 1.35;
}

.merchant-week-closed {
  text-align: center;
  color: #94a3b8;
  padding-top: 12px;
  font-weight: 600;
}

@media (max-width: 640px) {
  .merchant-week-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.remote-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1/1;
  border: 2px solid var(--text-main);
  border-radius: 16px;
  background: white;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  padding: 8px;
  gap: 5px;
  box-shadow: var(--shadow-flat);
  overflow: hidden;
  min-width: 0;
}

.remote-btn:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 4px 4px 0px var(--text-main);
}

.remote-btn:active {
  transform: translateY(1px);
  box-shadow: 1px 1px 0px var(--text-main);
}

.remote-btn svg {
  width: 24px;
  height: 24px;
  margin-bottom: 2px;
}

.remote-btn span,
.remote-btn-text {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-main);
  text-align: center;
  line-height: 1.2;
  max-width: 100%;
}

.remote-btn-text--compact {
  font-size: 9px;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.remote-settings-header {
  border-bottom: 1.5px dashed #cbd5e1;
  padding-bottom: 12px;
  margin-bottom: 5px;
}

.remote-settings-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.remote-input {
  flex: 1;
  min-width: 0;
  padding: 6px 10px;
  border: 2px solid var(--text-main);
  border-radius: 10px;
  font-size: 13px;
  background: white;
}

.remote-select {
  width: 85px;
  padding: 5px;
  border: 2px solid var(--text-main);
  border-radius: 10px;
  font-size: 12px;
  background: white;
  flex-shrink: 0;
}

.icon-svg {
  width: 1.2em;
  height: 1.2em;
  vertical-align: -0.2em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.back-btn svg, #village-menu-main-fab svg {
  stroke-width: 2.5;
  width: 28px;
  height: 28px;
}

/* 🔙 返回按鈕樣式 (Chubby Glass Style) */
.nav-bar {
  display: flex;
  align-items: center;
  padding: 5px 0;
}

.back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  background: rgba(255, 255, 255, 0.3); 
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 2.5px solid var(--text-main);
  border-radius: 18px;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  padding: 0;
  margin: 10px;
  box-shadow: var(--shadow-flat);
}

.back-btn:hover {
  background: rgba(255, 255, 255, 0.5);
  transform: translate(-2px, -2px) scale(1.05);
  box-shadow: 4px 4px 0px var(--text-main);
}

.back-btn:active {
  transform: translate(1px, 1px) scale(0.95);
  box-shadow: 1px 1px 0px var(--text-main);
}

.back-btn svg {
  width: 26px;
  height: 26px;
}

/* 🧭 側邊導航列 */
.quick-nav-sidebar {
  position: fixed; left: 0; top: 0; bottom: 0; width: 140px;
  background: var(--bg-surface); border-right: 2px solid var(--text-main);
  overflow-y: auto; padding: 20px 15px; z-index: 50;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 🚀 收合狀態 */
body.sidebar-collapsed .quick-nav-sidebar {
  width: 0;
  padding: 20px 0;
  border-right: none;
  overflow: hidden;
}

body.sidebar-collapsed {
  padding-left: 0 !important;
}

.nav-item { font-size: 13px; color: var(--text-main); margin-bottom: 12px; cursor: pointer; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: 0.7; }
.nav-item.active-nav { opacity: 1; font-weight: 900; color: var(--color-brand); transform: scale(1.1); }

/* ↔️ 側邊欄收合切換鈕 (電腦版專屬) */
#sidebar-toggle-btn {
  position: fixed;
  left: 140px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 60px;
  background: var(--bg-surface);
  border: 2px solid var(--text-main);
  border-left: none;
  border-radius: 0 10px 10px 0;
  cursor: pointer;
  z-index: 51;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--text-main);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 2px 0px 0px var(--text-main);
}

body.sidebar-collapsed #sidebar-toggle-btn {
  left: 0;
}

#sidebar-toggle-btn:hover {
  background: white;
  width: 28px;
}

/* 🟢 懸浮按鈕 */
#village-menu-container,
#sea-admin-menu-container {
  z-index: 10100;
}

#back-to-top {
  display: none; position: fixed; bottom: 25px; left: 50%; transform: translateX(-50%);
  width: 45px; height: 45px; background: rgba(31, 90, 133, 0.7); color: white;
  border: 2px solid white; border-radius: 50%; cursor: pointer; z-index: 10100;
  font-size: 20px; align-items: center; justify-content: center; backdrop-filter: blur(4px);
  transition: 0.3s;
  pointer-events: auto;
}
#back-to-top:hover { background: rgba(31, 90, 133, 1); transform: translateX(-50%) scale(1.1); }

#version-display.version-display--dev,
.version-display-inline.version-display--dev {
  color: #b45309;
  font-weight: 700;
}
#version-display.version-display--live,
.version-display-inline.version-display--live {
  color: #64748b;
  font-weight: 600;
}

.menu-item-btn--update .version-display-inline {
  display: block;
  font-size: 11px;
  line-height: 1.35;
  text-align: center;
  opacity: 0.9;
}

#version-display.version-display--outdated,
.version-display-inline.version-display--outdated {
  color: #c2410c;
  font-weight: 800;
}

/* ── 可更新提示（頂部橫幅 + 浮動 toast + 按鈕高亮）── */
@keyframes updateBannerPulse {
  0%, 100% { box-shadow: 0 2px 12px rgba(234, 88, 12, 0.35); }
  50% { box-shadow: 0 4px 20px rgba(234, 88, 12, 0.55); }
}
@keyframes updateToastBounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-4px); }
}
@keyframes updateBadgePulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.08); opacity: 0.85; }
}

.update-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 25000;
  display: flex;
  justify-content: center;
  padding: 10px 12px;
  padding-top: max(10px, env(safe-area-inset-top, 0px));
  background: linear-gradient(135deg, #ea580c 0%, #f59e0b 100%);
  color: #fff;
  animation: updateBannerPulse 2s ease-in-out infinite;
  box-shadow: 0 4px 16px rgba(234, 88, 12, 0.4);
}
.update-banner__inner {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 720px;
  flex-wrap: wrap;
  justify-content: center;
}
.update-banner__icon { font-size: 22px; flex-shrink: 0; }
.update-banner__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 140px;
  text-align: center;
}
.update-banner__text strong { font-size: 15px; letter-spacing: 0.02em; }
.update-banner__ver {
  font-size: 12px;
  opacity: 0.95;
  font-family: ui-monospace, monospace;
  font-weight: 600;
}
.update-banner__btn {
  background: #fff;
  color: #c2410c;
  border: none;
  padding: 8px 18px;
  border-radius: 20px;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: transform 0.15s, box-shadow 0.15s;
}
.update-banner__btn:hover {
  transform: scale(1.04);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
.update-banner__dismiss {
  background: rgba(255, 255, 255, 0.25);
  border: none;
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}
.update-banner__dismiss:hover { background: rgba(255, 255, 255, 0.4); }

body.has-update-banner .app-container {
  padding-top: calc(56px + env(safe-area-inset-top, 0px));
}

.update-toast {
  position: fixed;
  bottom: 110px;
  left: 50%;
  transform: translateX(-50%);
  display: none;
  align-items: center;
  gap: 12px;
  z-index: 20000;
  max-width: min(92vw, 420px);
  padding: 14px 18px;
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  color: #fff;
  border-radius: 16px;
  border: 2px solid #f59e0b;
  box-shadow: 0 8px 32px rgba(245, 158, 11, 0.45), 0 0 0 4px rgba(245, 158, 11, 0.15);
}
.update-toast--visible {
  animation: updateToastBounce 2s ease-in-out infinite;
}
.update-toast__icon { font-size: 24px; flex-shrink: 0; }
.update-toast__body { flex: 1; min-width: 0; }
.update-toast__title { display: block; font-size: 15px; margin-bottom: 2px; }
.update-toast__sub { font-size: 12px; color: #fcd34d; line-height: 1.35; }
.update-toast__btn {
  background: linear-gradient(135deg, #f59e0b, #ea580c);
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 22px;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(234, 88, 12, 0.4);
}
.update-toast__btn:hover { filter: brightness(1.08); }

.update-available-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 10px;
  animation: updateBadgePulse 1.5s ease-in-out infinite;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.5);
  letter-spacing: 0.03em;
}

.menu-item-btn--update.has-update {
  background: linear-gradient(135deg, #fff7ed, #ffedd5) !important;
  color: #c2410c !important;
  border: 2px solid #f59e0b !important;
  animation: updateBannerPulse 2.5s ease-in-out infinite;
}

#auth-btn.has-update {
  position: relative;
  background: linear-gradient(135deg, #f59e0b, #ea580c) !important;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.45), 0 4px 12px rgba(234, 88, 12, 0.35) !important;
}
#auth-btn.has-update::after {
  content: '';
  position: absolute;
  top: -4px;
  right: -4px;
  width: 12px;
  height: 12px;
  background: #ef4444;
  border: 2px solid #fff;
  border-radius: 50%;
  animation: updateBadgePulse 1.5s ease-in-out infinite;
}

@media (min-width: 801px) { 
  body:not(.sidebar-collapsed) { padding-left: 140px; }
}

@media (max-width: 800px) {
  .quick-nav-sidebar, #sidebar-toggle-btn { display: none !important; }
  .search-container { flex-direction: column; }
  .app-container { padding: 10px; }
  .game-list-container.card-mode { grid-template-columns: repeat(var(--card-cols, 2), minmax(0, 1fr)); gap: 6px; }
  .card-mode .game-item-card { transition: none !important; border-width: 1.5px; border-radius: 10px; min-width: 0; max-width: 100%; }
  .card-mode .inv-card-layout,
  .card-mode .game-info-wrapper,
  .card-mode .game-thumb,
  .card-mode .game-thumb-placeholder { min-width: 0; max-width: 100%; }
  .card-mode .game-info-wrapper { padding: 6px; }
  .card-mode .game-item-title { font-size: 13px; font-weight: 800; min-height: auto; margin-bottom: 2px; }
  .card-mode .game-card-details,
  .card-mode .game-card-expand-hint { display: none !important; }
  .card-mode .game-card-name { -webkit-line-clamp: 3; word-break: break-word; overflow-wrap: anywhere; }
  .game-card-title-actions {
    display: flex !important;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
    max-width: 100%;
  }
  .game-card-title-actions .save-btn,
  .game-card-title-actions .game-chat-share-btn,
  .game-card-title-actions .share-btn,
  .game-card-title-actions .admin-only-btn,
  .game-card-title-actions .external-share-btn {
    padding: 3px 7px !important;
    font-size: 11px !important;
    border-width: 1.5px !important;
    box-shadow: none !important;
    margin-left: 0 !important;
    min-width: 0;
    flex: 0 1 auto;
  }
  #inv-list,
  #sea-list,
  body.inv-tab-active #home-view {
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
  }
  .inv-home-toolbar {
    flex-wrap: wrap;
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
  }
  .inv-current-home-label {
    flex: 1 1 auto;
    max-width: calc(100% - 52px);
  }
  #inv-home-toolbar #home-invite-code-btn {
    margin-left: 0;
    max-width: 100%;
  }
  .inv-limit-bar,
  .inv-overflow-warning {
    max-width: 100%;
    box-sizing: border-box;
    flex-wrap: wrap;
  }
  .inv-overflow-warning__body { min-width: 0; flex: 1 1 160px; }
  .game-list-container:not(.card-mode) .game-item-card {
    max-width: 100%;
    box-sizing: border-box;
  }
  .game-list-container:not(.card-mode) .inv-card-layout {
    min-width: 0;
    max-width: 100%;
  }
  .game-list-container:not(.card-mode) .game-item-title {
    min-width: 0;
  }
  #current-home-name { font-size: 13px; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  
  /* 🚀 讓「桌伴公開大廳」在手機版縮短為「桌伴聚落」 */
  .public-lobby-text { font-size: 0 !important; }
  .public-lobby-text::before { content: "桌伴聚落"; font-size: 14px !important; }

  /* 將原本在右下角、正下方的懸浮按鈕往上推，避免被底部導航列遮擋 */
  #back-to-top {
    bottom: calc(120px + env(safe-area-inset-bottom, 0px)) !important;
    z-index: 10100 !important;
  }
  #village-menu-container {
    bottom: calc(120px + env(safe-area-inset-bottom, 0px)) !important;
    z-index: 10100 !important;
  }
  body.village-menu-open #village-menu-container {
    z-index: 10500 !important;
  }
  #sea-admin-menu-container {
    bottom: calc(120px + env(safe-area-inset-bottom, 0px)) !important;
    z-index: 10100 !important;
  }

}
/* 🍞 吐司通知樣式 */
.toast-notice {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(30, 41, 59, 0.9);
  backdrop-filter: blur(8px);
  color: white;
  padding: 12px 24px;
  border-radius: 50px;
  font-weight: bold;
  font-size: 14px;
  z-index: 30000;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
  border: 1px solid rgba(255,255,255,0.1);
  white-space: nowrap;
}

@keyframes slideUp { from { transform: translate(-50%, 100%); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

/* 🌐 語言切換邏輯 */
body.lang-zh .lang-en { display: none !important; }
body.lang-en .lang-zh { display: none !important; }

/* 👤 個人空間按鈕樣式 */
.menu-item-btn {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--text-main);
  border-radius: 14px;
  background: white;
  color: var(--text-main);
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 3px 3px 0px var(--text-main);
  margin-bottom: 5px;
}

.menu-item-btn:hover {
  background: #f8fafc;
  transform: translate(-2px, -2px);
  box-shadow: 5px 5px 0px var(--text-main);
}

.menu-item-btn:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0px var(--text-main);
}

.menu-item-btn svg {
  width: 20px;
  height: 20px;
  stroke-width: 2.5;
}

@media (max-width: 800px) {
  /* --- Mobile Bottom Navigation Bar --- */
  :root {
    --mobile-mega-nav-h: 52px;
    --mobile-sub-nav-h: 46px;
  }

  .app-container {
    padding-bottom: calc(var(--mobile-mega-nav-h) + env(safe-area-inset-bottom, 0px)) !important;
  }
  body.mobile-subnav-visible .app-container {
    padding-bottom: calc(var(--mobile-mega-nav-h) + var(--mobile-sub-nav-h) + env(safe-area-inset-bottom, 0px)) !important;
  }

  .app-bottom-nav {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100% !important;
    z-index: 10000 !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    pointer-events: auto !important;
    touch-action: manipulation;
  }

  .app-bottom-nav .mega-tab-buttons,
  .app-bottom-nav .sub-tab-row {
    pointer-events: auto;
  }

  .app-bottom-nav .sub-tab-row {
    order: 1;
    position: static !important;
    width: 100% !important;
    margin-bottom: 0 !important;
    border: none !important;
    background: rgba(255,255,255,0.98) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 0 !important;
    padding: 8px 12px !important;
    border-top: 1px solid #e2e8f0 !important;
    border-bottom: 1px solid #e2e8f0 !important;
    z-index: 1 !important;
    overflow-x: auto !important;
    justify-content: flex-start !important;
    -webkit-overflow-scrolling: touch;
  }

  .app-bottom-nav .mega-tab-buttons {
    order: 2;
    position: static !important;
    bottom: auto !important;
    left: auto !important;
    width: 100% !important;
    background: rgba(255, 255, 255, 0.98) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid #e2e8f0 !important;
    z-index: 2 !important;
    margin: 0 !important;
    padding: 2px 0 calc(2px + env(safe-area-inset-bottom, 0px)) 0 !important;
    justify-content: space-around !important;
    gap: 0 !important;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05) !important;
    border-radius: 0 !important;
  }
  
  .mega-tab-btn {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 2px !important;
    padding: 4px 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    transform: none !important;
    color: #94a3b8 !important;
    border-bottom: none !important;
  }

  .mega-tab-btn:hover {
    background: transparent !important;
    transform: none !important;
    box-shadow: none !important;
  }

  .mega-tab-btn:active {
    transform: scale(0.95) !important;
    box-shadow: none !important;
  }

  .mega-tab-btn svg.nav-icon {
    width: 20px !important;
    height: 20px !important;
    margin: 0 !important;
    stroke: currentColor !important;
    fill: none !important;
  }
  
  .mega-tab-btn span {
    font-size: 10px !important;
    font-weight: 700 !important;
  }

  .mega-tab-btn.active {
    background: transparent !important;
    color: #0ea5e9 !important;
    border: none !important;
    box-shadow: none !important;
  }
  
  .mega-tab-btn.active svg {
    stroke: #0ea5e9 !important;
  }

  .app-bottom-nav .sub-tab-group {
    justify-content: flex-start !important;
    padding-right: 20px;
  }

  /* 調整 Toast Notice 的位置，避免被底部導航列遮擋 */
  .toast-notice {
    bottom: calc(var(--mobile-mega-nav-h) + 16px + env(safe-area-inset-bottom, 0px)) !important;
  }
  
  /* 調整更新提示框的位置 */
  #update-toast,
  .update-toast {
    bottom: calc(var(--mobile-mega-nav-h) + 16px + env(safe-area-inset-bottom, 0px)) !important;
  }
  body.mobile-subnav-visible .toast-notice,
  body.mobile-subnav-visible #update-toast,
  body.mobile-subnav-visible .update-toast {
    bottom: calc(var(--mobile-mega-nav-h) + var(--mobile-sub-nav-h) + 16px + env(safe-area-inset-bottom, 0px)) !important;
  }
}

/* 🗺️ Map Layout Styles */
.map-layout-container {
  display: flex;
  height: calc(100vh - 180px);
  margin: 0 -20px -20px -20px;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  background: white;
}

.map-sidebar {
  width: 320px;
  display: flex;
  flex-direction: column;
  background: #f8fafc;
  border-right: 1px solid #e2e8f0;
  z-index: 10;
  box-shadow: 2px 0 8px rgba(0,0,0,0.05);
}

.map-sidebar-search {
  padding: 12px;
  border-bottom: 1px solid #e2e8f0;
  background: white;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.map-sidebar-search input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  box-sizing: border-box;
}

.map-sidebar-search input[type="text"]:focus {
  border-color: #0ea5e9;
  box-shadow: 0 0 0 2px #e0f2fe;
}

.map-search-toolbar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.map-toolbar-btn {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  color: #334155;
}

.map-toolbar-btn--locate {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1d4ed8;
}

.map-toolbar-btn--locate.is-loading {
  opacity: 0.65;
  pointer-events: none;
}

.map-toolbar-btn--clear {
  background: #fff7ed;
  border-color: #fdba74;
  color: #c2410c;
}

.map-area-search {
  display: flex;
  gap: 6px;
}

.map-area-search input {
  flex: 1;
  min-width: 0;
}

.map-area-search-btn {
  padding: 0 14px;
  border: none;
  border-radius: 8px;
  background: #0ea5e9;
  color: white;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.map-region-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.map-region-chip {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #e2e8f0;
  background: white;
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  cursor: pointer;
}

.map-region-chip:hover {
  border-color: #0ea5e9;
  color: #0369a1;
  background: #f0f9ff;
}

.map-area-status {
  font-size: 11px;
  color: #0369a1;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 8px;
  padding: 6px 10px;
  line-height: 1.4;
}

.map-sidebar-search input {
  width: 100%;
  padding: 10px 15px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  box-sizing: border-box;
}

.map-sidebar-search input:focus {
  border-color: #0ea5e9;
  box-shadow: 0 0 0 2px #e0f2fe;
}

.map-sidebar-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.map-sidebar-item {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.map-sidebar-item:hover {
  border-color: #94a3b8;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
  transform: translateY(-1px);
}

.map-sidebar-item.store {
  border-left: 4px solid #2563eb;
}

.map-sidebar-item.lfg {
  border-left: 4px solid #16a34a;
}

.map-main {
  flex: 1;
  position: relative;
  min-height: 280px;
}

.map-popup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.map-popup-btn {
  flex: 1 1 auto;
  min-width: 0;
  padding: 8px 10px;
  border: none;
  border-radius: 6px;
  font-weight: bold;
  font-size: 12px;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  display: inline-block;
  box-sizing: border-box;
}

.map-popup-btn--primary {
  background: #2563eb;
  color: white;
}

.map-popup-btn--secondary {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
}

.map-popup-btn--link {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.map-sidebar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.map-sidebar-btn {
  padding: 5px 10px;
  font-size: 11px;
  font-weight: bold;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: white;
  color: #334155;
  cursor: pointer;
}

.map-sidebar-btn--copy {
  background: #f0f9ff;
  color: #0369a1;
  border-color: #bae6fd;
}

.map-sidebar-btn:hover {
  filter: brightness(0.97);
}

.map-legend--overlay {
  position: absolute;
  bottom: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.92);
  padding: 10px 12px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  font-size: 13px;
}

.map-legend__row {
  display: flex;
  align-items: center;
  margin-bottom: 5px;
}

.map-legend__row:last-child {
  margin-bottom: 0;
}

.map-legend__dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 6px;
  flex-shrink: 0;
}

.map-legend__dot--store { background: #2563eb; }
.map-legend__dot--lfg { background: #16a34a; }
.map-legend__dot--user { background: #0ea5e9; box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.25); }

.map-user-loc-icon {
  background: transparent;
  border: none;
}

.map-user-loc-dot {
  width: 16px;
  height: 16px;
  background: #0ea5e9;
  border: 3px solid white;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.35), 0 2px 8px rgba(0, 0, 0, 0.25);
  animation: map-user-pulse 2s ease-out infinite;
}

@keyframes map-user-pulse {
  0% { box-shadow: 0 0 0 0 rgba(14, 165, 233, 0.45), 0 2px 8px rgba(0, 0, 0, 0.25); }
  70% { box-shadow: 0 0 0 10px rgba(14, 165, 233, 0), 0 2px 8px rgba(0, 0, 0, 0.25); }
  100% { box-shadow: 0 0 0 0 rgba(14, 165, 233, 0), 0 2px 8px rgba(0, 0, 0, 0.25); }
}

.map-sidebar-item__distance {
  font-size: 11px;
  color: #0ea5e9;
  font-weight: 700;
  margin-bottom: 4px;
}

@media (max-width: 800px) {
  .map-layout-container {
    flex-direction: column-reverse;
  }
  .map-sidebar {
    width: 100%;
    height: 40%;
    border-right: none;
    border-top: 1px solid #e2e8f0;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.05);
  }
  .map-sidebar-list {
    padding: 8px;
    gap: 8px;
  }
  .map-sidebar-search {
    padding: 10px;
  }
  .map-main {
    height: 60%;
  }
}

@media (max-width: 800px) {
  /* 將原本在右下角、正下方的懸浮按鈕往上推，避免被底部導航列與子分頁遮擋 */
  #back-to-top {
    bottom: calc(120px + env(safe-area-inset-bottom, 0px)) !important;
    z-index: 10100 !important;
  }
  #village-menu-container {
    bottom: calc(120px + env(safe-area-inset-bottom, 0px)) !important;
    z-index: 10100 !important;
  }
  body.village-menu-open #village-menu-container {
    z-index: 10500 !important;
  }
  #sea-admin-menu-container {
    bottom: calc(120px + env(safe-area-inset-bottom, 0px)) !important;
    z-index: 10100 !important;
  }
}

@media (max-width: 800px) {
  /* 避免聚落名稱被擠壓折行 */
  .header {
    position: relative;
    z-index: 10200;
  }
  .header-top-row {
    position: sticky;
    top: 0;
    z-index: 10210;
    background: var(--bg-main, #fff);
    padding: 6px 0 10px;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    border-bottom: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
  }
  /* 手機版：彈窗須高於 sticky header (z-index 10210) */
  .modal-overlay {
    z-index: 30000 !important;
    align-items: flex-start !important;
    padding-top: max(12px, calc(58px + env(safe-area-inset-top, 0px))) !important;
    padding-bottom: max(12px, env(safe-area-inset-bottom, 0px)) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  body.has-update-banner .modal-overlay {
    padding-top: max(12px, calc(94px + env(safe-area-inset-top, 0px))) !important;
  }
  .modal-overlay > .modal-content {
    max-height: calc(100dvh - 72px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) !important;
    margin-bottom: 12px;
  }
  .header-top-row > div:last-child {
    flex-shrink: 0;
    margin-left: auto;
    margin-right: 0;
    gap: 6px;
  }
  #invite-btn {
    /* display: none !important; */
  }
  #auth-btn.logged-in {
    width: 35px !important;
    height: 35px !important;
    padding: 0 !important;
    display: inline-flex !important;
    justify-content: center !important;
    align-items: center !important;
    border-radius: 50% !important;
    border: 1.5px solid #cbd5e1 !important;
    background: white !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05) !important;
  }
  #auth-btn.logged-in img {
    margin-right: 0 !important;
    width: 26px !important;
    height: 26px !important;
  }
  #auth-btn.logged-in .auth-btn-name {
    display: none !important;
  }
  #main-title-area {
    flex: 1;
    min-width: 0;
    overflow: hidden;
  }
  #main-title-area img[alt="桌伴"] {
    height: 52px !important;
    margin-right: 6px !important;
  }
  #home-switcher-area.home-switcher-area--header {
    display: none !important;
  }

  /* 聚落工具列手機微調（共用樣式見上方） */
  .inv-home-toolbar {
    padding: 10px 12px 6px;
    margin-bottom: 0;
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-top: none;
    box-shadow: none;
  }

  #home-switcher-area {
    flex: 1;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
  }
  #home-dropdown-container {
    max-width: 100%;
  }
  #home-dropdown-btn {
    max-width: 100%;
  }
  #home-dropdown-container.open .dropdown-menu,
  #home-dropdown-container .dropdown-menu {
    z-index: 10300 !important;
  }
  #app-bottom-nav-anchor {
    height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
  }
  #current-home-display-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
    display: inline-block;
    vertical-align: middle;
  }
  
  /* 邀請碼按鈕：手機僅保留圖示與複製鈕，文字在寬螢幕顯示 */
  #inv-home-toolbar #home-invite-code-text {
    display: none;
  }
  #inv-home-toolbar .inv-home-invite-icon,
  #inv-home-toolbar .inv-home-invite-copy {
    display: inline-flex !important;
  }
  #inv-home-toolbar #home-invite-code-btn {
    padding: 0 10px !important;
    gap: 4px !important;
    max-width: 120px;
  }

  /* 舊版 header 邀請碼（若仍存在） */
  #home-switcher-area #home-invite-code-text, 
  #home-switcher-area #home-invite-code-btn span:first-child {
    display: none !important;
  }
  
  #home-switcher-area #home-invite-code-btn {
    padding: 0 10px !important;
    gap: 0 !important;
  }

  #market-list.main-list-pane--active,
  #news-list.main-list-pane--active,
  #chat-list.main-list-pane--active {
    position: relative;
    z-index: 1;
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    box-sizing: border-box;
  }
}

/* === 聚落工具列（桌機＋手機共用） === */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.inv-home-toolbar {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 10px 12px 6px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  position: relative;
  z-index: 2;
  flex-wrap: nowrap;
  min-width: 0;
}

body.inv-tab-active .inv-home-toolbar {
  display: flex;
}

.inv-home-menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  background: white;
  color: #334155;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.inv-home-menu-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

.inv-home-menu-btn svg {
  width: 22px;
  height: 22px;
  display: block;
  stroke: currentColor;
}

.inv-current-home-label {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 0 1 auto;
  min-width: 0;
  max-width: 200px;
}

.inv-home-dropdown {
  position: static;
  flex-shrink: 0;
}

.inv-home-dropdown .dropdown-menu {
  min-width: 220px;
}

#home-options-menu.home-menu-portal {
  display: block !important;
  position: fixed !important;
  margin: 0 !important;
  transform: none !important;
  background: var(--bg-main, #fff);
  border: 2px solid var(--text-main, #334155);
  border-radius: 16px;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.1);
  padding: 6px;
}

#inv-home-toolbar #home-invite-code-btn {
  display: inline-flex !important;
  align-items: center;
  gap: 5px;
  flex-shrink: 1;
  min-width: 0;
  margin-left: auto;
}

@media (min-width: 801px) {
  .inv-home-toolbar {
    padding: 12px 16px;
    margin-bottom: 12px;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    border-bottom-width: 1.5px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
  }

  .inv-current-home-label {
    font-size: 15px;
    max-width: 280px;
    flex: 0 0 auto;
  }

  #inv-home-toolbar #home-invite-code-text {
    display: inline !important;
    max-width: min(280px, 32vw);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
  }

  #inv-home-toolbar #home-invite-code-btn {
    max-width: min(380px, 42vw);
  }
}

/* 當進入聊天室時隱藏頂部工具列與底部導覽，包廂固定於視窗頂端全螢幕 */
body.in-room-mode {
  overflow: hidden !important;
}
body.in-room-mode .header,
body.in-room-mode .header-toolbar,
body.in-room-mode #app-bottom-nav,
body.in-room-mode #app-bottom-nav-anchor,
body.in-room-mode .quick-nav-sidebar,
body.in-room-mode .inv-home-toolbar {
  display: none !important;
}
body.in-room-mode .app-container {
  padding: 0 !important;
  margin: 0 !important;
  max-width: none !important;
  width: 100% !important;
}
body.in-room-mode #home-view {
  padding: 0 !important;
}
body.in-room-mode #home-view > :not(#room-view) {
  display: none !important;
}
body.in-room-mode #room-view {
  display: flex !important;
  flex-direction: column !important;
  position: fixed !important;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100% !important;
  max-width: 100vw !important;
  height: 100dvh !important;
  height: 100vh !important;
  max-height: 100dvh !important;
  margin: 0 !important;
  margin-top: 0 !important;
  border-radius: 0 !important;
  border: none !important;
  box-shadow: none !important;
  z-index: 9999;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  overflow: hidden;
}
body.in-room-mode #room-chat-section {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* 聊天分頁主清單（桌機側欄並排） */
@media (min-width: 801px) {
  #chat-list.main-list-pane--active {
    flex: 1 1 auto;
    min-height: min(70vh, 800px);
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
  }
}

@media (max-width: 800px) {
  body.in-room-mode #room-view {
    width: 100vw !important;
  }
  #chat-list,
  #chat-list.main-list-pane--active {
    padding: 0 10px 12px !important;
    box-sizing: border-box;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
  }
  #chat-auth-content {
    padding: 0 !important;
    width: 100%;
    box-sizing: border-box;
  }
  #lobby-view {
    width: 100%;
    box-sizing: border-box;
  }
  #my-rooms-list {
    width: 100%;
    box-sizing: border-box;
  }

  #room-view {
    width: 100% !important;
    max-width: 100vw !important;
    box-sizing: border-box;
  }
  #chat-messages {
    min-height: 0;
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}


.chat-room-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  margin-bottom: 10px;
  width: 100%;
  box-sizing: border-box;
}
.chat-room-card__main {
  flex: 1 1 180px;
  min-width: 0;
}
.chat-room-card__title {
  font-weight: bold;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 4px;
}
.chat-room-card__actions {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.chat-room-card__enter {
  background: #0ea5e9;
  color: white;
  border: none;
  padding: 8px 14px;
  border-radius: 15px;
  cursor: pointer;
  font-weight: bold;
  font-size: 12px;
  white-space: nowrap;
}

.horizontal-scroll-container { scrollbar-width: thin; scrollbar-color: #cbd5e1 transparent; }
.horizontal-scroll-container::-webkit-scrollbar { height: 6px; }
.horizontal-scroll-container::-webkit-scrollbar-track { background: transparent; }
.horizontal-scroll-container::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

.tag-suggest-dropdown {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 3000;
  background: #fff;
  border: 1.5px solid #cbd5e1;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  max-height: 220px;
  overflow-y: auto;
  padding: 6px;
}

.tag-suggest-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  font-size: 13px;
  color: #334155;
  gap: 8px;
}

.tag-suggest-item:hover,
.tag-suggest-item.is-active {
  background: #eff6ff;
  color: #1d4ed8;
}

.tag-suggest-item small {
  color: #94a3b8;
  font-size: 11px;
  flex-shrink: 0;
}

/* 聚落庫存上限進度條 */
.sea-count-bar {
  display: flex;
  align-items: center;
  margin: 0 0 12px;
  padding: 10px 14px;
  background: #eff6ff;
  border: 1.5px solid #bfdbfe;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
  color: #1e40af;
}
.sea-count-bar__text { flex: 1; min-width: 0; }

.inv-limit-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  padding: 10px 14px;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
  color: #475569;
}
.inv-limit-bar__track {
  flex: 0 0 88px;
  height: 8px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}
.inv-limit-bar__fill {
  height: 100%;
  width: 0;
  background: #0ea5e9;
  border-radius: 999px;
  transition: width 0.25s ease;
}
.inv-limit-bar__fill--warn { background: #f59e0b; }
.inv-limit-bar__fill--full { background: #ef4444; }
.inv-limit-bar__fill--over { background: #dc2626; }
.inv-limit-bar__text { flex: 1; min-width: 0; }
.inv-limit-bar__help {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1.5px solid #cbd5e1;
  background: white;
  color: #64748b;
  font-weight: 900;
  cursor: pointer;
  font-size: 12px;
}
.inv-limit-vip-badge {
  display: inline-block;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 8px;
  background: #fef9c3;
  color: #a16207;
  border: 1px solid #fde68a;
}
.inv-limit-extra-badge {
  display: inline-block;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 8px;
  background: #ecfdf5;
  color: #059669;
  font-weight: 800;
}

.inv-overflow-warning {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 10px 12px;
  margin: 0 0 12px;
  padding: 12px 14px;
  background: #fef2f2;
  border: 1.5px solid #fecaca;
  border-radius: 12px;
  font-size: 12px;
  color: #7f1d1d;
  line-height: 1.55;
}
.inv-overflow-warning__icon { font-size: 18px; line-height: 1; flex-shrink: 0; }
.inv-overflow-warning__body { flex: 1; min-width: 200px; }
.inv-overflow-warning__title { font-weight: 800; font-size: 13px; margin-bottom: 4px; color: #991b1b; }
.inv-overflow-warning__desc strong { color: #b91c1c; }
.inv-overflow-warning__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
}
@media (min-width: 520px) {
  .inv-overflow-warning__actions { width: auto; margin-left: auto; flex-shrink: 0; }
}
.inv-overflow-warning__btn {
  border: none;
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.inv-overflow-warning__btn--export {
  background: #dc2626;
  color: white;
}
.inv-overflow-warning__btn--dismiss {
  background: white;
  color: #64748b;
  border: 1.5px solid #e2e8f0;
}

/* 外部贊助廣告 */
.external-ad-strip {
  margin: 0 0 12px;
  padding: 10px 14px;
  background: linear-gradient(90deg, #f8fafc, #fff);
  border: 1.5px dashed #cbd5e1;
  border-radius: 12px;
  font-size: 13px;
}
.external-ad-strip__label {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}
.external-ad-strip__body { color: #475569; font-weight: 600; min-height: 0; }
.external-ad-strip__body .adsbygoogle {
  display: block;
  min-height: 90px;
  min-width: 1px;
  overflow: hidden;
}
.external-ad-link {
  color: #0369a1;
  text-decoration: none;
}
.external-ad-link:hover { text-decoration: underline; }

/* 列表內穿插廣告 */
.inline-ad-card {
  background: linear-gradient(180deg, #f8fafc, #fff);
  border: 1.5px dashed #e2e8f0;
  border-radius: 12px;
  padding: 8px 12px;
  margin: 2px 0;
  box-sizing: border-box;
}
.card-mode .inline-ad-card {
  grid-column: 1 / -1;
}
.inline-ad-card__label {
  display: block;
  font-size: 10px;
  font-weight: 800;
  color: #94a3b8;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}
  .inline-ad-card__body .adsbygoogle {
  display: block;
  min-height: 90px;
  min-width: 1px;
  overflow: hidden;
}
.user-ad-card__link {
  display: block;
  text-decoration: none;
  color: inherit;
}
.user-ad-card__inner {
  display: flex;
  gap: 10px;
  align-items: center;
}
.user-ad-card__img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
}
.user-ad-card__text {
  min-width: 0;
  flex: 1;
}
.user-ad-card__title {
  font-size: 13px;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 2px;
  line-height: 1.3;
}
.user-ad-card__desc {
  font-size: 12px;
  color: #64748b;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.inline-ad-card--user {
  border-style: solid;
  border-color: #fde68a;
  background: linear-gradient(180deg, #fffbeb, #fff);
}

.user-ad-type-btn {
  padding: 10px 8px;
  border-radius: 10px;
  border: 2px solid #e2e8f0;
  background: #f8fafc;
  color: #475569;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.user-ad-type-btn--active {
  border-color: #f59e0b;
  background: #fffbeb;
  color: #b45309;
}
.user-ad-type-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

#user-ad-popup-root {
  position: fixed;
  inset: 0;
  z-index: 14500;
  display: none;
}
.user-ad-popup {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  box-sizing: border-box;
}
.user-ad-popup__frame {
  width: min(420px, 100%);
  max-height: min(88vh, 640px);
  overflow: hidden;
  border-radius: 20px;
  background: linear-gradient(165deg, #ffffff, #faf5ff);
  border: 2px solid #c4b5fd;
  box-shadow: 0 24px 60px rgba(91, 33, 182, 0.25);
  display: flex;
  flex-direction: column;
}
.user-ad-popup__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid #ede9fe;
  background: linear-gradient(90deg, #f5f3ff, #fffbeb);
}
.user-ad-popup__badge {
  font-size: 11px;
  font-weight: 700;
  color: #6d28d9;
  letter-spacing: 0.02em;
}
.user-ad-popup__close {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: #f1f5f9;
  color: #64748b;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.user-ad-popup__close:hover {
  background: #e2e8f0;
  color: #334155;
}
.user-ad-popup__body {
  padding: 16px 18px 20px;
  overflow-y: auto;
  text-align: center;
}
.user-ad-popup__img {
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: 12px;
}
.user-ad-popup__title {
  font-size: 18px;
  font-weight: 800;
  color: #1e1b4b;
  margin-bottom: 8px;
  line-height: 1.35;
}
.user-ad-popup__desc {
  font-size: 13px;
  color: #475569;
  line-height: 1.55;
  margin-bottom: 14px;
  white-space: pre-wrap;
}
.user-ad-popup__cta {
  display: inline-block;
  padding: 10px 20px;
  border-radius: 12px;
  background: linear-gradient(135deg, #8b5cf6, #6d28d9);
  color: white;
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  margin-bottom: 10px;
}
.user-ad-popup__hint {
  font-size: 11px;
  color: #94a3b8;
}

/* 會員權益對照 */
.membership-tiers-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 16px;
}
@media (max-width: 560px) {
  .membership-tiers-grid { grid-template-columns: 1fr; }
}
.membership-tier-card {
  border: 2px solid #e2e8f0;
  border-radius: 16px;
  padding: 16px;
  background: white;
}
.membership-tier-card--vip {
  border-color: #fde68a;
  background: linear-gradient(160deg, #fffbeb, #ffffff);
  box-shadow: 0 8px 24px rgba(234, 179, 8, 0.12);
}
.membership-tier-card__head { margin-bottom: 12px; }
.membership-tier-card__head h3 { margin: 6px 0 4px; font-size: 18px; color: #1e293b; }
.membership-tier-card__badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
}
.membership-tier-card__badge--general { background: #f1f5f9; color: #64748b; }
.membership-tier-card__badge--vip { background: #fef08a; color: #854d0e; }
.membership-tier-card__price { margin: 0; font-size: 13px; color: #64748b; font-weight: 700; }
.membership-tier-card__list {
  margin: 0;
  padding-left: 18px;
  font-size: 12px;
  line-height: 1.65;
  color: #475569;
}
.membership-tier-card__cta {
  width: 100%;
  margin-top: 14px;
  padding: 10px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
  font-weight: 800;
  cursor: pointer;
}
.membership-tiers-note {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 13px;
  color: #334155;
}

/* 規則可視化編輯器 — 巢狀層級 */
.visual-editor-container {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px;
}

#visual-editor-items > .visual-item {
  margin-bottom: 12px;
}

.visual-item {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 8px;
  position: relative;
  transition: box-shadow 0.2s, border-color 0.2s;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.visual-item--fold {
  border-left: 4px solid #0ea5e9;
}

.visual-item--fold[data-depth="0"] {
  background: #f8fafc;
}

.visual-item--fold[data-depth="1"] {
  border-left-color: #38bdf8;
}

.visual-item--fold[data-depth="2"] {
  border-left-color: #7dd3fc;
}

.visual-item--fold[data-depth="3"],
.visual-item--fold[data-depth="4"] {
  border-left-color: #bae6fd;
}

.visual-item--list,
.visual-item--text {
  border-left: 3px solid #cbd5e1;
  background: #fefefe;
}

.v-fold-header,
.v-block-header {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.v-fold-icon {
  font-size: 14px;
  flex-shrink: 0;
}

.v-depth-badge {
  font-size: 10px;
  font-weight: 700;
  color: #0369a1;
  background: #e0f2fe;
  border: 1px solid #bae6fd;
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
  flex-shrink: 0;
}

.visual-item[data-depth="0"] .v-depth-badge {
  color: #0f766e;
  background: #ccfbf1;
  border-color: #99f6e4;
}

.v-title {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 700;
  padding: 6px 10px;
}

.v-block-label {
  font-size: 12px;
  color: #64748b;
  font-weight: 700;
  flex: 1;
}

.v-remove-btn {
  background: #fee2e2;
  color: #ef4444;
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 12px;
  flex-shrink: 0;
}

.v-remove-btn--sm {
  width: 24px;
  height: 24px;
  font-size: 10px;
}

.v-children {
  margin: 8px 0 4px 4px;
  padding: 8px 0 4px 14px;
  border-left: 2px solid #cbd5e1;
  min-height: 24px;
}

.v-children[data-depth="1"] { border-left-color: #7dd3fc; padding-left: 16px; }
.v-children[data-depth="2"] { border-left-color: #38bdf8; padding-left: 18px; }
.v-children[data-depth="3"] { border-left-color: #0ea5e9; padding-left: 20px; }
.v-children[data-depth="4"] { border-left-color: #0284c7; padding-left: 22px; }

.v-children:empty {
  min-height: 28px;
  border-left-style: dashed;
  border-left-color: #e2e8f0;
}

.v-children:empty::after {
  content: '（尚無子項目，可用下方按鈕新增）';
  display: block;
  font-size: 11px;
  color: #94a3b8;
  padding: 4px 0 0 4px;
}

.v-fold-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed #e2e8f0;
}

.v-add-btn {
  padding: 3px 10px !important;
  font-size: 10px !important;
}

.v-add-btn--fold {
  background: #e0f2fe !important;
  color: #0ea5e9 !important;
  border-color: #bae6fd !important;
}

.v-add-btn--list {
  background: #f0fdf4 !important;
  color: #10b981 !important;
  border-color: #bbf7d0 !important;
}

.v-add-btn--text {
  background: #f8fafc !important;
  color: #64748b !important;
  border-color: #e2e8f0 !important;
}

.visual-item .v-list-items {
  width: 100%;
  min-height: 80px;
  font-size: 12px;
  resize: vertical;
  box-sizing: border-box;
}

.visual-item .v-text-content {
  width: 100%;
  min-height: 60px;
  font-size: 12px;
  resize: vertical;
  box-sizing: border-box;
}

/* VIP / 代幣商店 */
.subscription-shop-tabs {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 14px;
  background: #f1f5f9;
  padding: 4px;
  border-radius: 12px;
}
.subscription-shop-tab {
  flex: 1;
  border: none;
  background: transparent;
  color: #64748b;
  font-weight: bold;
  font-size: 13px;
  padding: 8px 12px;
  border-radius: 9px;
  cursor: pointer;
}
.subscription-shop-tab.is-active {
  background: white;
  color: #0ea5e9;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.subscription-currency-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 16px;
  font-size: 12px;
}
.subscription-currency-bar__label { color: #94a3b8; margin-right: 2px; }
.subscription-currency-hint { color: #94a3b8; font-size: 11px; width: 100%; text-align: center; margin-top: 2px; }
.subscription-currency-btn {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 5px 12px;
  font-size: 12px;
  cursor: pointer;
  background: transparent;
  color: #64748b;
}
.subscription-currency-btn.is-active {
  background: #0ea5e9;
  color: #fff;
  font-weight: bold;
  border-color: #0ea5e9;
}
.subscription-section-label {
  text-align: left;
  font-size: 13px;
  font-weight: bold;
  color: #334155;
  margin-bottom: 10px;
}
.subscription-section-sublabel {
  font-weight: normal;
  color: #94a3b8;
  font-size: 11px;
  margin-left: 6px;
}
.pricing-plan-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  text-align: left;
}
.pricing-plan-grid--compact { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 640px) {
  .pricing-plan-grid { grid-template-columns: 1fr; }
  .pricing-plan-grid--compact { grid-template-columns: 1fr 1fr; }
}
.pricing-plan-card {
  position: relative;
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: 16px;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pricing-plan-card--featured {
  border-color: #eab308;
  background: linear-gradient(160deg, #fffbeb, #fff);
  box-shadow: 0 8px 20px rgba(234, 179, 8, 0.15);
}
.pricing-plan-card--compact { padding: 12px; }
.pricing-plan-card__ribbon {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: #eab308;
  color: white;
  font-size: 10px;
  font-weight: bold;
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
}
.pricing-plan-card__name { font-size: 15px; font-weight: bold; color: #334155; }
.pricing-plan-card__days { font-size: 11px; color: #94a3b8; }
.pricing-plan-card__list-price { font-size: 11px; color: #94a3b8; margin-top: 4px; }
.pricing-plan-card__list-price s { color: #cbd5e1; }
.pricing-plan-card__price-row { display: flex; align-items: baseline; gap: 4px; margin-top: 4px; }
.pricing-plan-card__price { font-size: 28px; font-weight: 800; color: #0ea5e9; line-height: 1; }
.pricing-plan-card--featured .pricing-plan-card__price { color: #d97706; }
.pricing-plan-card__price-unit { font-size: 12px; color: #94a3b8; font-weight: bold; }
.pricing-plan-card__fiat { font-size: 13px; color: #64748b; font-weight: 600; }
.pricing-plan-card__save { margin-top: 4px; }
.pricing-plan-card__save-badge {
  display: inline-block;
  background: #ecfdf5;
  color: #047857;
  font-size: 11px;
  font-weight: bold;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid #a7f3d0;
}
.pricing-plan-card__save-fiat { display: block; font-size: 10px; color: #94a3b8; margin-top: 2px; }
.pricing-plan-card__unit { font-size: 11px; color: #64748b; line-height: 1.45; margin-top: 2px; }
.pricing-plan-card__cta {
  margin-top: 10px;
  width: 100%;
  border: none;
  background: #f1f5f9;
  color: #0ea5e9;
  font-weight: bold;
  padding: 9px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
}
.pricing-plan-card--featured .pricing-plan-card__cta {
  background: #fef08a;
  color: #854d0e;
}
.pricing-token-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  text-align: left;
}
@media (max-width: 480px) {
  .pricing-token-grid { grid-template-columns: 1fr; }
}
.pricing-token-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: 14px;
  padding: 14px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.pricing-token-card:hover { border-color: #0ea5e9; box-shadow: 0 4px 12px rgba(14, 165, 233, 0.12); }
.pricing-token-card--anchor { opacity: 0.92; }
.pricing-token-card--value { border-color: #bfdbfe; background: #f8fbff; }
.pricing-token-card--hero,
.pricing-token-card--featured {
  border-color: #10b981;
  background: linear-gradient(160deg, #ecfdf5, #fff);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.12);
}
.pricing-token-card__badge {
  position: absolute;
  top: -8px;
  right: 10px;
  background: #10b981;
  color: white;
  font-size: 10px;
  font-weight: bold;
  padding: 2px 8px;
  border-radius: 10px;
}
.pricing-token-card__label { font-size: 14px; font-weight: bold; color: #334155; }
.pricing-token-card__pay { font-size: 20px; font-weight: 800; color: #0ea5e9; }
.pricing-token-card__bonus { font-size: 12px; color: #64748b; line-height: 1.45; }
.pricing-token-card__bonus--plain { color: #94a3b8; font-size: 11px; }
.pricing-token-card__compare { font-size: 11px; color: #10b981; font-weight: 600; }
.pricing-token-card__cta {
  margin-top: 6px;
  font-size: 12px;
  color: #0ea5e9;
  font-weight: bold;
}
.subscription-vip-benefits-box {
  font-size: 12px;
  color: #64748b;
  background: #f8fafc;
  padding: 15px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
}

/* 付多少 → 得多少 簡化標示 */
.pricing-simple__block {
  border-radius: 12px;
  padding: 10px 12px;
  margin-top: 6px;
}
.pricing-simple__block--pay {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}
.pricing-simple__block--get {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
}
.pricing-token-card--hero .pricing-simple__block--get,
.pricing-token-card--featured .pricing-simple__block--get {
  background: #ecfdf5;
  border-color: #a7f3d0;
}
.pricing-plan-card--featured .pricing-simple__block--get {
  background: #fffbeb;
  border-color: #fde68a;
}
.pricing-simple__label {
  font-size: 11px;
  font-weight: bold;
  color: #94a3b8;
  margin-bottom: 2px;
}
.pricing-simple__value {
  font-size: 20px;
  font-weight: 800;
  color: #334155;
  line-height: 1.25;
}
.pricing-simple__value--pay-line {
  font-size: 18px;
  line-height: 1.4;
}
.pricing-simple__or {
  font-size: 14px;
  font-weight: 700;
  color: #94a3b8;
  margin: 0 2px;
}
.pricing-simple__value--get {
  color: #0ea5e9;
  font-size: 17px;
}
.pricing-plan-card--featured .pricing-simple__value--get { color: #d97706; }
.pricing-simple__fiat {
  font-size: 14px;
  font-weight: 700;
  color: #64748b;
  margin-top: 2px;
}
.pricing-simple__sub {
  font-size: 11px;
  color: #64748b;
  margin-top: 4px;
  line-height: 1.45;
}
.pricing-simple__arrow {
  text-align: center;
  font-size: 12px;
  font-weight: bold;
  color: #94a3b8;
  margin: 6px 0 2px;
}
.pricing-simple__plus {
  color: #94a3b8;
  font-weight: normal;
  font-size: 16px;
}
.pricing-simple__bonus {
  color: #10b981;
}
.pricing-simple__zhe-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.pricing-simple__zhe {
  display: inline-block;
  background: #fef2f2;
  color: #dc2626;
  font-size: 13px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 8px;
  border: 1px solid #fecaca;
}
.pricing-simple__zhe-note {
  font-size: 11px;
  color: #94a3b8;
}

/* 賣場徵收區 */
.market-wanted-card {
  background: white;
  border-radius: 12px;
  padding: 16px;
  border: 1px solid #e9d5ff;
  box-shadow: 0 2px 8px rgba(139, 92, 246, 0.08);
  position: relative;
}
.market-wanted-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #8b5cf6;
  color: white;
  font-size: 11px;
  font-weight: bold;
  padding: 2px 8px;
  border-radius: 4px;
  margin-right: 6px;
}
.market-wanted-card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
  gap: 10px;
}
.market-wanted-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  font-size: 12px;
  color: #64748b;
  margin-bottom: 4px;
}
.market-wanted-slots-label {
  font-size: 11px;
  color: #8b5cf6;
  font-weight: bold;
  margin-bottom: 8px;
}
.market-wanted-row--top {
  border-color: #c4b5fd;
  background: #f5f3ff;
}
.market-wanted-match {
  font-size: 10px;
  color: #7c3aed;
  font-weight: bold;
}
.market-wanted-match--high {
  color: #059669;
}
.market-wanted-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #faf5ff;
  border: 1px solid #ede9fe;
  border-radius: 8px;
  margin-bottom: 8px;
}
.market-wanted-row__badge {
  font-size: 10px;
  font-weight: bold;
  color: #7c3aed;
  background: #ede9fe;
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}
.market-wanted-row__main {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  color: #334155;
}
.market-wanted-row__offer {
  color: #6d28d9;
  font-weight: bold;
}
.market-wanted-row__user {
  display: block;
  font-size: 11px;
  color: #94a3b8;
  margin-top: 2px;
}
.market-wanted-trade-btn {
  background: #10b981;
  color: white;
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  font-weight: bold;
  font-size: 13px;
  cursor: pointer;
  flex-shrink: 0;
}
.market-wanted-done-btn {
  background: #0ea5e9;
  color: white;
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  font-weight: bold;
  font-size: 13px;
  cursor: pointer;
  flex-shrink: 0;
}
.market-wanted-seller-condition {
  margin: 10px 0;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.market-wanted-card__footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed #e9d5ff;
}
.market-wanted-action-btn {
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: bold;
  font-size: 13px;
  cursor: pointer;
}
.market-wanted-action-btn--join {
  background: #8b5cf6;
  color: white;
}
.market-wanted-action-btn--bid {
  background: #f59e0b;
  color: white;
}
.market-wanted-trading-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: #fef3c7;
  color: #b45309;
  font-size: 11px;
  font-weight: bold;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid #fde68a;
}

/* 賣場／交流區搜尋：桌遊預覽卡簡介折疊 */
.board-game-info-card-market--compact .inv-card-layout {
  gap: 12px;
}
.board-game-info-card-market--compact .game-thumb,
.board-game-info-card-market--compact .game-thumb-placeholder {
  width: 72px;
  height: 72px;
  flex-shrink: 0;
}
.board-game-info-card-market--compact .game-item-title {
  font-size: 15px;
}
.board-game-desc-fold {
  position: relative;
  margin-top: 6px;
  cursor: pointer;
  border-radius: 8px;
}
.board-game-desc-fold:not(.is-expanded) .board-game-desc-fold__body {
  max-height: 0;
  overflow: hidden;
}
.board-game-desc-fold:not(.is-expanded)::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 28px;
  height: 0;
  display: none;
}
.board-game-desc-fold.is-expanded {
  cursor: default;
}
.board-game-desc-fold.is-expanded::after {
  display: none;
}
.board-game-desc-fold__hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12px;
  color: #64748b;
  padding: 6px 4px 2px;
  font-weight: 700;
  line-height: 1.4;
}
.board-game-desc-fold.is-expanded .board-game-desc-fold__hint {
  display: none;
}
.board-game-desc-fold__body {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: #475569;
}

@media (min-width: 801px) {
  .mobile-only-menu-btn {
    display: none !important;
  }
}

.mobile-console-output {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  margin: 0;
  padding: 10px 12px;
  overflow: auto;
  background: #0f172a;
  color: #e2e8f0;
  font-size: 10px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 0;
}

/* 手機除錯浮動視窗（不阻擋背景操作） */
.mobile-console-float {
  position: fixed;
  z-index: 16000;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}
.mobile-console-float.is-open {
  pointer-events: none;
}
.mobile-console-float__panel {
  position: fixed;
  left: 8px;
  top: 72px;
  width: min(92vw, 340px);
  height: min(42vh, 300px);
  min-width: 220px;
  min-height: 160px;
  max-width: calc(100vw - 16px);
  max-height: calc(100vh - 90px);
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 10px 40px rgba(15, 23, 42, 0.28);
  border: 1px solid #cbd5e1;
  overflow: hidden;
  touch-action: none;
}
.mobile-console-float__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
  cursor: move;
  touch-action: none;
  user-select: none;
  flex-shrink: 0;
}
.mobile-console-float__title {
  margin: 0;
  font-size: 13px;
  color: #334155;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
}
.mobile-console-float__close {
  background: #f1f5f9;
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.mobile-console-float__footer {
  display: flex;
  gap: 6px;
  padding: 8px 10px;
  border-top: 1px solid #e2e8f0;
  background: #fff;
  flex-shrink: 0;
}
.mobile-console-float__btn {
  flex: 1;
  font-size: 12px !important;
  padding: 8px 6px !important;
  background: #f8fafc !important;
}
.mobile-console-float__btn--primary {
  background: #e0f2fe !important;
  color: #0369a1 !important;
}
.mobile-console-float__resize {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 26px;
  height: 26px;
  cursor: nwse-resize;
  touch-action: none;
  background: linear-gradient(135deg, transparent 50%, rgba(14, 165, 233, 0.35) 50%);
  border-bottom-right-radius: 12px;
}
