/* The city > place > clip hierarchy is shared by the side panel and bottom sheet. */
.trail-panel {
  --muted: #617580;
  --line: rgba(11, 51, 82, .16);
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 110;
  display: flex;
  flex-direction: column;
  width: min(420px, 34vw);
  background: rgba(255, 253, 244, .98);
  backdrop-filter: blur(18px);
  border-left: 1px solid var(--line);
  box-shadow: -18px 0 60px rgba(11, 51, 82, .035);
  transform: translateX(102%);
  transition: transform .36s cubic-bezier(.2, .8, .2, 1);
}
.trail-panel.is-open { transform: translateX(0); }
.tp-header {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: max(26px, env(safe-area-inset-top)) calc(27px + env(safe-area-inset-right)) 22px calc(27px + env(safe-area-inset-left));
  border-bottom: 1px solid var(--line);
}
.tp-heading { min-width: 0; }
.tp-kicker { margin: 0 0 7px; color: var(--muted); font-size: 10px; letter-spacing: .12em; }
.tp-title { margin: 0; font-size: 23px; font-weight: 700; line-height: 1.3; letter-spacing: 0; }
.tp-close {
  display: grid;
  flex: none;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 23px;
  font-weight: 300;
}
.tp-intro { flex: none; margin: 15px calc(26px + env(safe-area-inset-right)) 0 calc(26px + env(safe-area-inset-left)); color: var(--muted); font-size: 11px; line-height: 1.8; }
.tp-list {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  padding: 7px calc(26px + env(safe-area-inset-right)) calc(35px + env(safe-area-inset-bottom)) calc(26px + env(safe-area-inset-left));
}
.tp-city { margin: 20px 0 0; padding: 0; border: 0; }
.tp-city-heading {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-height: 44px;
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.5;
}
.tp-city-label { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; min-width: 0; }
.tp-city-name { overflow-wrap: anywhere; }
.tp-city-region { color: var(--muted); font-size: 11px; font-weight: 400; }
.tp-places { margin: 2px 0 0 8px; padding-left: 15px; border-left: 1px solid var(--line); }
.tp-row { min-width: 0; border-bottom: 1px solid var(--line); border-radius: 5px; }
.tp-row:last-child, .tp-primary { border-bottom: 0; }
.tp-row.is-hovered { background: rgba(11, 51, 82, .035); }
.tp-row-heading { margin: 0; font-size: inherit; }
.tp-toggle {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 16px;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  padding: 14px 0;
  font: inherit;
  text-align: left;
}
.tp-city-toggle { grid-template-columns: minmax(0, 1fr) 16px; padding: 10px 0; }
.tp-place-name { display: flex; align-items: center; gap: 7px; min-width: 0; font-size: 14px; font-weight: 600; line-height: 1.6; }
.tp-place-label { min-width: 0; overflow-wrap: anywhere; }
.tp-kind { flex: none; width: 14px; height: 14px; fill: none; stroke: var(--muted); stroke-width: 1.2; }
.tp-periods {
  max-width: 7.5em;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  font-weight: 400;
  line-height: 1.6;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tp-chevron { width: 16px; height: 16px; font-size: 19px; font-weight: 300; line-height: 16px; text-align: center; transition: transform .22s ease; }
.tp-row.is-selected .tp-chevron { transform: rotate(45deg); }
.tp-city.is-city-selected > .tp-primary > .tp-city-heading > .tp-toggle,
.tp-row.is-selected > .tp-row-heading > .tp-toggle,
.tp-row.is-selected > .tp-city-heading > .tp-toggle { color: var(--ink); }

/* Keep only clip lists in the layout while hidden; inert/aria-hidden remove interaction. */
.tp-detail {
  display: grid;
  grid-template-rows: 1fr;
  opacity: 1;
  visibility: visible;
  overflow-wrap: anywhere;
  transition: grid-template-rows .24s ease, opacity .18s ease, visibility 0s linear;
}
.trail-panel .tp-detail[hidden] {
  display: grid !important;
  grid-template-rows: 0fr;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: grid-template-rows .24s ease, opacity .18s ease, visibility 0s linear .24s;
}
.tp-detail-inner { min-height: 0; overflow: hidden; }
.tp-detail-inner > :last-child { margin-bottom: 16px; }
.tp-detail-label { margin: 2px 0 10px; color: var(--muted); font-size: 11px; font-weight: 500; }
.tp-place-en { margin: 2px 0 10px; color: var(--muted); font-size: 11px; }
.tp-mention {
  position: relative;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  margin: 0 0 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
}
.tp-mention.is-untimed { grid-template-columns: minmax(0, 1fr); }
.tp-mention-body { min-width: 0; }
.tp-quote { margin: 0; font-size: 14px; font-weight: 500; line-height: 1.85; }
.tp-shownote { margin: 0; color: #4a6278; font-size: 13px; font-weight: 400; line-height: 1.85; }
.tp-play {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--bg);
  font-size: 13px;
  line-height: 1;
  transition: color .15s ease, background .15s ease, border-color .15s ease;
}
.tp-play svg { width: 13px; height: 13px; }
.tp-play:disabled { opacity: .5; cursor: default; }
.tp-mention.is-playing .tp-play { border-color: var(--ink); background: var(--ink); color: var(--paper); }
/* 播放进度：不单独占一行，只在按钮外圈画一圈细环（平时隐藏） */
.tp-play::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%; pointer-events: none; opacity: 0;
  background: conic-gradient(var(--ink) calc(var(--p, 0) * 360deg), var(--line) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 2px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 2px));
  transition: opacity .2s ease;
}
.tp-mention.is-playing .tp-play::after { opacity: 1; }
.tp-meta { display: flex; align-items: center; gap: 8px; min-width: 0; margin-top: 3px; }
.tp-episode { flex: 1; min-width: 0; margin: 0; overflow: hidden; color: var(--muted); font-size: 10px; font-weight: 500; line-height: 1.7; text-overflow: ellipsis; white-space: nowrap; }
.tp-full { display: inline-flex; flex: none; align-items: center; min-width: 44px; min-height: 44px; font-size: 10px; text-decoration: underline; text-underline-offset: 4px; white-space: nowrap; }
.tp-progress { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.tp-progress progress { display: block; flex: 1; min-width: 0; height: 2px; appearance: none; border: 0; accent-color: var(--ink); background: var(--line); }
.tp-progress progress::-webkit-progress-bar { background: var(--line); }
.tp-progress progress::-webkit-progress-value { background: var(--ink); }
.tp-progress progress::-moz-progress-bar { background: var(--ink); }
.tp-time { flex: none; color: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tp-message { margin: 8px 0 0; color: var(--muted); font-size: 11px; line-height: 1.7; }
.tp-message:empty { display: none; }
.tp-empty { padding: 35px 0; color: var(--muted); font-size: 13px; }
.trail-panel button:focus-visible, .trail-panel a:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
@media (hover: hover) {
  .tp-toggle:hover { color: var(--soft); }
  .tp-play:hover:not(:disabled), .tp-close:hover { border-color: var(--ink); }
}
@media (max-width: 959px) {
  .trail-panel {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 52vh;
    height: var(--trail-sheet-height, 52dvh);
    min-height: 240px;
    max-height: calc(100dvh - 90px - env(safe-area-inset-top));
    border-left: 0;
    border-top: 1px solid var(--line);
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -15px 40px rgba(11, 51, 82, .05);
    transform: translateY(104%);
  }
  .trail-panel::before { content: ''; position: absolute; top: 8px; left: calc(50% - 16px); width: 32px; height: 3px; border-radius: 3px; background: var(--line); }
  .trail-panel.is-open { transform: translateY(var(--panel-drag-y, 0px)); }
  .trail-panel.is-dragging { transition: none; }
  .tp-header { touch-action: none; padding: 23px calc(22px + env(safe-area-inset-right)) 14px calc(22px + env(safe-area-inset-left)); }
  .tp-kicker { margin-bottom: 4px; font-size: 9px; }
  .tp-title { font-size: 21px; }
  .tp-intro { margin: 10px calc(22px + env(safe-area-inset-right)) 0 calc(22px + env(safe-area-inset-left)); }
  .tp-list { padding: 0 calc(22px + env(safe-area-inset-right)) calc(26px + env(safe-area-inset-bottom)) calc(22px + env(safe-area-inset-left)); }
  .tp-toggle { padding: 13px 0; }
  .tp-city-toggle { padding: 10px 0; }
  .tp-place-name { font-size: 13px; }
}
@media (max-width: 359px) {
  .tp-header { padding-right: calc(16px + env(safe-area-inset-right)); padding-left: calc(16px + env(safe-area-inset-left)); }
  .tp-intro { margin-right: calc(16px + env(safe-area-inset-right)); margin-left: calc(16px + env(safe-area-inset-left)); }
  .tp-list { padding-right: calc(16px + env(safe-area-inset-right)); padding-left: calc(16px + env(safe-area-inset-left)); }
  .tp-places { padding-left: 12px; }
  .tp-mention { gap: 8px; padding: 10px; }
  .tp-periods { max-width: 6em; }
}
@media (prefers-reduced-motion: reduce) {
  .trail-panel, .trail-panel * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
