/**
 * [INPUT]: 依赖 shrine-collection.ts 输出的里程碑票券语义、account-detail-panels.css 的统一弹层外壳与 App 同源封面资源
 * [OUTPUT]: 提供与 A7 里程碑页同构的全屏标题栏、封面取色渐变票券、星级、日期、时长及空错误状态
 * [POS]: public 的里程碑专属视觉层，只定义完读记录呈现，不承担首页密度或请求行为
 * [PROTOCOL]: 变更时更新此头部，然后检查 CLAUDE.md
 */

.shrine-modal-milestone {
  --milestone-canvas: #f2f3fa;
}

.shrine-modal-milestone .shrine-modal-sheet {
  width: min(100%, 940px);
  max-height: min(920px, calc(100dvh - 32px));
  background: var(--milestone-canvas);
}

.shrine-modal-milestone .shrine-modal-heading {
  min-height: 78px;
  position: relative;
  border-bottom-color: rgba(77, 82, 105, 0.08);
  background: var(--milestone-canvas);
}

.shrine-modal-milestone .shrine-modal-heading h3 {
  font-size: 29px;
}

.milestone-back {
  width: 42px;
  height: 42px;
  padding: 4px;
  position: absolute;
  left: 20px;
  top: 50%;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  transform: translateY(-50%);
}

.milestone-back:active {
  transform: translateY(-50%) scale(0.94);
}

.milestone-back img {
  width: 32px;
  height: 32px;
  display: block;
}

.shrine-modal-milestone .shrine-modal-content {
  padding: 18px 22px 24px;
  background: var(--milestone-canvas);
  scrollbar-gutter: stable;
}

.milestone-list {
  display: grid;
  gap: 15px;
}

.milestone-ticket {
  --milestone-stat-width: 132px;
  --milestone-ticket-bg: #f9f9fc;
  min-width: 0;
  min-height: 158px;
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--milestone-stat-width);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.94);
  border-radius: 2px;
  background: var(--milestone-ticket-bg);
  box-shadow: 0 1px 3px rgba(52, 57, 78, 0.05);
  cursor: pointer;
}

.milestone-ticket:focus-visible {
  outline: 3px solid rgba(76, 126, 177, 0.52);
  outline-offset: 2px;
}

.milestone-ticket::before,
.milestone-ticket::after {
  content: "";
  width: 22px;
  height: 22px;
  position: absolute;
  right: calc(var(--milestone-stat-width) - 11px);
  z-index: 3;
  border-radius: 50%;
  background: var(--milestone-canvas);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.7);
}

.milestone-ticket::before {
  top: -12px;
}

.milestone-ticket::after {
  bottom: -12px;
}

.milestone-style-1 {
  --milestone-ticket-bg: #fff4f5;
}

.milestone-style-2 {
  --milestone-ticket-bg: #f4f6ff;
}

.milestone-style-3 {
  --milestone-ticket-bg: #f8f4fb;
}

.milestone-main {
  min-width: 0;
  padding: 18px 22px 18px 18px;
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: 91px minmax(0, 1fr);
  gap: 18px;
  overflow: hidden;
}

.milestone-main::before,
.milestone-main::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.milestone-main::before {
  z-index: -2;
  inset: -36px;
  background: var(--milestone-cover-image) center / cover no-repeat;
  filter: blur(26px) saturate(0.92);
  opacity: 0.46;
  transform: scale(1.08);
}

.milestone-main::after {
  z-index: -1;
  inset: 0;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.06) 0%, rgba(249, 249, 252, 0.52) 58%, var(--milestone-ticket-bg) 100%);
}

.milestone-cover {
  width: 91px;
  height: 122px;
  display: block;
  align-self: center;
  object-fit: cover;
  background: #e4e5eb;
  box-shadow: 0 1px 2px rgba(37, 40, 53, 0.08);
}

.milestone-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.milestone-copy h4 {
  margin: 1px 0 0;
  overflow: hidden;
  color: #474a54;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.milestone-copy p {
  margin: 7px 0 0;
  overflow: hidden;
  color: #888b96;
  font-family: var(--font-display);
  font-size: 17px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.milestone-rating-row {
  min-width: 0;
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 14px;
}

.milestone-stars {
  min-width: 0;
  position: relative;
  display: inline-block;
  overflow: hidden;
  color: #cfd1d8;
  font-family: Arial, sans-serif;
  font-size: 24px;
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
}

.milestone-stars::before {
  content: "★★★★★";
  width: var(--rating-width);
  position: absolute;
  inset: 0 auto 0 0;
  overflow: hidden;
  color: #5e616b;
  white-space: nowrap;
}

.milestone-stars > span {
  display: block;
}

.milestone-note {
  flex: 0 0 auto;
  color: #656973;
  font-family: Arial, sans-serif;
  font-size: 24px;
  line-height: 1;
}

.milestone-stats {
  min-width: 0;
  padding: 17px 10px 14px;
  display: grid;
  align-content: space-between;
  justify-items: center;
  border-left: 1px solid rgba(91, 95, 112, 0.08);
  background: color-mix(in srgb, var(--milestone-ticket-bg) 88%, #fff);
  font-family: var(--font-display);
  text-align: center;
}

.milestone-stats time {
  display: grid;
  gap: 4px;
  color: #676a74;
}

.milestone-stats time span {
  font-size: 18px;
  line-height: 1;
}

.milestone-stats time strong {
  font-size: 18px;
  font-weight: 400;
  line-height: 1.1;
}

.milestone-duration {
  display: grid;
  color: #757882;
  font-size: 15px;
  line-height: 1.15;
}

.milestone-duration span {
  white-space: nowrap;
}

.milestone-duration b {
  margin-right: 2px;
  color: #181a20;
  font-size: 34px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.milestone-empty {
  min-height: 280px;
  padding: 32px;
  display: grid;
  place-items: center;
  color: #747887;
  font-family: var(--font-display);
  font-size: 17px;
  text-align: center;
}

.milestone-empty.is-error {
  color: var(--danger);
}

.milestone-review-dialog {
  padding: 20px;
  position: fixed;
  z-index: 80;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: auto;
  background: rgba(30, 34, 48, 0.5);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.milestone-review-dialog[hidden] {
  display: none;
}

.milestone-review-sheet {
  width: min(560px, 100%);
  max-height: calc(100dvh - 40px);
  padding: 24px;
  position: relative;
  overflow: auto;
  color: #30333d;
  border: 1px solid rgba(100, 105, 126, 0.16);
  border-radius: 8px;
  background: #fafafe;
  box-shadow: 0 22px 70px rgba(24, 28, 42, 0.3);
}

.milestone-review-close {
  width: 38px;
  height: 38px;
  padding: 0;
  position: absolute;
  z-index: 2;
  top: 13px;
  right: 13px;
  display: grid;
  place-items: center;
  color: #555966;
  border: 0;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  font-family: Arial, sans-serif;
  font-size: 26px;
  line-height: 1;
}

.milestone-review-close:active {
  transform: scale(0.94);
}

.milestone-review-book {
  padding-right: 34px;
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  align-items: center;
  gap: 16px;
}

.milestone-review-book > img {
  width: 88px;
  height: 120px;
  display: block;
  object-fit: cover;
  background: #e5e6eb;
}

.milestone-review-book h3 {
  margin: 0;
  color: #30333c;
  font-family: var(--font-display);
  font-size: 24px;
  line-height: 1.3;
}

.milestone-review-book p {
  margin: 7px 0 16px;
  color: #838793;
  font-family: var(--font-display);
  font-size: 15px;
}

.milestone-review-content {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid rgba(82, 87, 105, 0.12);
}

.milestone-review-content h4 {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: 18px;
}

.milestone-review-content p {
  margin: 0;
  color: #555966;
  font-family: var(--font-display);
  font-size: 16px;
  line-height: 1.75;
  white-space: pre-wrap;
}

.milestone-review-content p.is-empty {
  color: #9699a3;
}

@media (max-width: 680px) {
  .shrine-modal-milestone {
    padding: 0;
  }

  .shrine-modal-milestone .shrine-modal-sheet {
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    border: 0;
    border-radius: 0;
  }

  .shrine-modal-milestone .shrine-modal-heading {
    min-height: 74px;
    padding: 20px 16px 14px;
  }

  .shrine-modal-milestone .shrine-modal-heading h3 {
    font-size: 27px;
  }

  .milestone-back {
    left: 12px;
  }

  .shrine-modal-milestone .shrine-modal-content {
    padding: 12px 10px 18px;
  }

  .milestone-list {
    gap: 11px;
  }

  .milestone-ticket {
    --milestone-stat-width: 92px;
    min-height: 128px;
  }

  .milestone-ticket::before,
  .milestone-ticket::after {
    width: 18px;
    height: 18px;
    right: calc(var(--milestone-stat-width) - 9px);
  }

  .milestone-ticket::before {
    top: -10px;
  }

  .milestone-ticket::after {
    bottom: -10px;
  }

  .milestone-main {
    padding: 13px 15px 13px 12px;
    grid-template-columns: 67px minmax(0, 1fr);
    gap: 12px;
  }

  .milestone-cover {
    width: 67px;
    height: 96px;
  }

  .milestone-copy h4 {
    font-size: 18px;
    line-height: 1.32;
  }

  .milestone-copy p {
    margin-top: 4px;
    font-size: 14px;
  }

  .milestone-rating-row {
    gap: 8px;
  }

  .milestone-stars,
  .milestone-note {
    font-size: 19px;
  }

  .milestone-stats {
    padding: 13px 6px 11px;
  }

  .milestone-stats time {
    gap: 3px;
  }

  .milestone-stats time span,
  .milestone-stats time strong {
    font-size: 15px;
  }

  .milestone-duration {
    font-size: 12px;
  }

  .milestone-duration b {
    font-size: 28px;
  }

  .milestone-review-dialog {
    padding: 10px;
  }

  .milestone-review-sheet {
    width: 100%;
    max-height: calc(100dvh - 20px);
    padding: 20px 18px;
  }

  .milestone-review-book {
    padding-right: 30px;
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 13px;
  }

  .milestone-review-book > img {
    width: 72px;
    height: 98px;
  }

  .milestone-review-book h3 {
    font-size: 20px;
  }

  .milestone-review-book p {
    margin: 5px 0 11px;
    font-size: 14px;
  }

  .milestone-review-content {
    margin-top: 18px;
    padding-top: 15px;
  }

  .milestone-review-content p {
    font-size: 15px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .milestone-back {
    transition: none;
  }
}

@media (prefers-reduced-transparency: reduce) {
  .milestone-main::before {
    display: none;
  }
}
