/* 资讯面板、底部抽屉（规格书 §4.4、§5、§6.2） */

.tm-panel {
  position: absolute; z-index: 40;
  top: 12px; bottom: 12px; inset-inline-end: 12px;
  width: calc(var(--tm-panel-w) - 24px);
  display: flex; flex-direction: column;
  border: var(--tm-line); border-radius: var(--tm-radius);
  background: var(--tm-paper); box-shadow: 6px 6px 0 var(--tm-ink);
  overflow: hidden;
  transform: translateX(calc(100% + 32px)); opacity: 0;
  transition: transform .35s var(--tm-bounce), opacity .2s ease;
}
[dir="rtl"] .tm-panel { transform: translateX(calc(-100% - 32px)); }
.tm-panel.is-open { transform: none; opacity: 1; }
.tm-panel:focus { outline: none; }

.tm-panel__grab { display: none; }
.tm-panel__close { position: absolute; z-index: 3; top: 12px; inset-inline-end: 12px; background: var(--tm-card); }
.tm-panel__scroll { position: relative; flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; }
.tm-panel__media { position: relative; flex: none; aspect-ratio: 16 / 9; border-bottom: var(--tm-line); background: var(--tm-card); overflow: hidden; }
.tm-panel__body { flex: 1 0 auto; display: flex; flex-direction: column; gap: 12px; padding: 16px 20px 8px; }
.tm-panel__title { margin: 0; font-size: 24px; line-height: 1.2; font-weight: 700; }
.tm-panel__title:focus { outline: none; }
.tm-panel__desc { margin: 0; font-size: 15.5px; line-height: 1.6; white-space: pre-line; }

/* 图片占位插画 */
.tm-art { position: absolute; inset: 0; }
.tm-art svg { display: block; }
.tm-art__emoji {
  position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%);
  font-size: 64px; line-height: 1; filter: drop-shadow(3px 3px 0 rgba(45, 42, 50, .25));
}

/* 图片轮播 */
.tm-gallery { position: absolute; inset: 0; }
.tm-gallery__track {
  display: flex; width: 100%; height: 100%; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
  touch-action: pan-x;
}
.tm-gallery__track::-webkit-scrollbar { display: none; }
.tm-slide { position: relative; flex: 0 0 100%; height: 100%; margin: 0; scroll-snap-align: start; }
.tm-slide img { display: block; width: 100%; height: 100%; object-fit: cover; }
.tm-slide__credit {
  position: absolute; inset-inline-start: 8px; bottom: 8px; max-width: calc(100% - 16px);
  padding: 2px 8px; border-radius: 999px; background: rgba(45, 42, 50, .7); color: #FFFFFF; font-size: 11px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tm-gallery__dots { position: absolute; inset-inline: 0; bottom: 10px; display: flex; justify-content: center; gap: 2px; }
.tm-gallery__dot {
  width: 24px; height: 24px; padding: 0; border: 0; background: none; cursor: pointer; display: grid; place-items: center;
}
.tm-gallery__dot::before {
  content: ""; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--tm-ink); background: rgba(255, 255, 255, .8);
}
.tm-gallery__dot[aria-current="true"]::before { background: var(--tm-primary); }

/* 徽章 */
.tm-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.tm-badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px 3px 6px;
  border: 2px solid var(--tm-ink); border-radius: 999px;
  background: var(--c-soft, var(--tm-card)); color: var(--c-ink, var(--tm-ink));
  font-size: 13px; font-weight: 600; line-height: 1.3;
}
.tm-badge__emoji { font-size: 14px; }
.tm-badge--secret { background: #EADFFE; color: #3B1F7A; }

/* 特色 */
.tm-highlights { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.tm-highlights li { position: relative; padding-inline-start: 24px; font-size: 15px; }
.tm-highlights li::before {
  content: ""; position: absolute; inset-inline-start: 2px; top: .45em; width: 10px; height: 10px; border-radius: 50%;
  background: var(--c, var(--tm-primary)); border: 2px solid var(--tm-ink);
}

/* 标签：营业时间、建议游览时间、距离 */
.tm-tags { display: grid; gap: 8px; }
.tm-tag {
  display: flex; align-items: flex-start; gap: 10px; padding: 8px 12px;
  border: 2px solid var(--tm-ink); border-radius: calc(var(--tm-radius) * .6); background: var(--tm-card);
}
.tm-tag__emoji { font-size: 18px; line-height: 1.3; }
.tm-tag__text { display: flex; flex-direction: column; min-width: 0; }
.tm-tag__label { font-size: 12px; font-weight: 600; color: var(--tm-ink-soft); }
.tm-tag__value { font-size: 15px; font-weight: 500; white-space: pre-line; }

/* 操作按钮：桌面一行 4 个，手机 2×2 */
.tm-actions {
  position: sticky; bottom: 0; z-index: 2; flex: none;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px;
  padding: 18px 12px 14px;
  background: linear-gradient(to bottom, rgba(255, 248, 236, 0), var(--tm-paper) 16px);
}
.tm-actions[data-count="3"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tm-action {
  flex-direction: column; gap: 3px; min-height: 64px; padding: 6px 2px;
  font-size: 12px; text-align: center; box-shadow: 3px 3px 0 var(--tm-ink);
}
.tm-action__emoji { font-size: 20px; line-height: 1; }
.tm-action__label { overflow-wrap: normal; word-break: normal; line-height: 1.15; }
.tm-action[aria-pressed="true"] { background: var(--tm-primary); color: var(--tm-primary-ink); }
.tm-action__emoji.is-bounce { animation: tm-pop .45s var(--tm-bounce); }

/* ---------- 手机：底部抽屉 ---------- */
@media (max-width: 767.98px) {
  .tm-panel {
    top: auto; bottom: 0; inset-inline: 0; width: auto;
    height: calc(100% - 66px - env(safe-area-inset-top, 0px));
    border-bottom: 0; border-radius: var(--tm-radius) var(--tm-radius) 0 0;
    box-shadow: 0 -4px 0 rgba(45, 42, 50, .15);
    opacity: 1; transform: translate3d(0, 110%, 0);
    transition: transform .38s cubic-bezier(.22, 1.2, .36, 1);
  }
  [dir="rtl"] .tm-panel { transform: translate3d(0, 110%, 0); }
  .tm-panel.is-dragging { transition: none; }
  .tm-panel__grab {
    display: flex; justify-content: center; flex: none; padding: 4px 0 0; touch-action: none; cursor: grab;
  }
  .tm-panel__handle { width: 88px; height: 32px; padding: 0; border: 0; background: none; display: grid; place-items: center; cursor: grab; }
  .tm-panel__handle span { width: 48px; height: 6px; border-radius: 3px; background: var(--tm-ink); }
  .tm-panel__close { top: 44px; }
  .tm-panel__media { aspect-ratio: auto; height: clamp(110px, 30vw, 170px); border-top: var(--tm-line); }
  .tm-panel[data-sheet="full"] .tm-panel__media { height: clamp(170px, 50vw, 260px); }
  .tm-panel[data-sheet="half"] .tm-panel__scroll { overflow: hidden; max-height: calc(var(--tm-sheet-visible) - 36px); }
  .tm-panel.is-short[data-sheet="half"] .tm-panel__media { display: none; }
  .tm-panel.is-short[data-sheet="half"] .tm-panel__close { top: 6px; }
  .tm-panel__body { padding: 14px 16px 6px; gap: 10px; }
  .tm-panel__title { font-size: 21px; padding-inline-end: 4px; }
  .tm-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 14px 12px calc(12px + env(safe-area-inset-bottom, 0px)); }
  .tm-actions[data-count="3"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tm-action { flex-direction: row; gap: 8px; min-height: 48px; font-size: 14.5px; }
  .tm-action__emoji { font-size: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .tm-panel { transition: opacity .2s linear; }
  .tm-action__emoji.is-bounce { animation: none; }
}

/* 平板宽度的面板比较窄：操作按钮的字小一点，长的马来文、较宽的顾客字体也放得下 */
@media (min-width: 768px) and (max-width: 1023.98px) {
  .tm-action { font-size: 11.5px; }
}
