/* Live-room interaction states. Loaded after the legacy visual layers so the
   existing reference layout stays intact while dynamic states remain legible. */
.comment-status {
  position: absolute;
  z-index: 7;
  left: 12px;
  right: 12px;
  bottom: calc(var(--live-hot-bottom, 70px) + var(--live-hot-height, 60px) + 5px);
  min-height: 24px;
  padding: 5px 10px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 13px;
  background: rgba(18,18,22,.78);
  color: rgba(255,255,255,.86);
  font-size: 12px;
  line-height: 14px;
  text-align: center;
  pointer-events: none;
  backdrop-filter: blur(8px);
}
.comment-status[data-state="loading"] { color: #ffe8a1; }
.comment-status[data-state="error"] { color: #ffd0d0; border-color: rgba(255,112,112,.42); }
.comment-status[data-state="pending"] { color: #ffe7aa; border-color: rgba(255,201,40,.38); }
.comment.is-pending {
  border: 1px dashed rgba(255,201,40,.48);
  color: rgba(255,255,255,.82);
}
.comment .comment-state {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 5px;
  border-radius: 6px;
  background: rgba(255,201,40,.18);
  color: #ffe082;
  font-size: 10px;
  font-weight: 700;
  vertical-align: 1px;
}
.comment.is-failed .comment-state { background: rgba(255,80,80,.18); color: #ffc2c2; }

.product {
  grid-template-columns: 86px minmax(0, 1fr) auto;
  align-items: stretch;
}
.product-img img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}
.product-copy { min-width: 0; }
.product-copy h3 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.product-copy p { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.product-price-row { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.product-price-row .price { white-space: nowrap; }
.product-live-price { color: #e9434d; font-size: 11px; font-weight: 700; }
.product-stock { margin-top: 4px; color: #7e8996; font-size: 11px; }
.product-stock.is-low { color: #e27b25; }
.product-stock.is-empty { color: #a2a8b0; }
.product-action { display: flex; align-items: flex-end; }
.product .buy {
  min-width: 58px;
  white-space: nowrap;
  transition: opacity .16s ease, transform .16s ease;
}
.product .buy:not(:disabled):active { transform: scale(.96); }
.product .buy:disabled { background: #c8cdd3; color: #fff; cursor: not-allowed; }
.product .buy[data-state="loading"] { opacity: .72; }
.bag-count[data-empty="true"] { opacity: .72; }

#lecturePrice { white-space: normal; }
#hotSaleCount { display: inline-block; min-width: 42px; }
.hot-sale-card[data-metric-state="loading"] #hotSaleCount,
.hot-sale-card[data-metric-state="error"] #hotSaleCount { font-size: 13px; min-width: 50px; }
.hot-sale-card[data-metric-state="error"] { filter: saturate(.86); }

@media (max-width: 390px) {
  .product { grid-template-columns: 70px minmax(0, 1fr) auto; gap: 8px; }
  .product-img { width: 70px; height: 70px; }
  .product .buy { min-width: 52px; padding-left: 9px; padding-right: 9px; }
  .comment-status { left: 8px; right: 8px; }
}

/* Mobile resilience: keep the interaction layer readable when comments and
   product data are longer than the reference content. */
.comments {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 7px;
  min-height: 0;
  max-height: min(210px, 31svh);
  padding: 2px 2px 4px 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.28) transparent;
}
.comments::-webkit-scrollbar { width: 4px; }
.comments::-webkit-scrollbar-track { background: transparent; }
.comments::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(255,255,255,.28);
}
.comment {
  display: block;
  width: fit-content;
  max-width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
  line-height: 1.42;
}
.comment .fan-badge {
  max-width: 100%;
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.comment .fan-badge-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.comment b,
.comment .comment-state {
  vertical-align: middle;
}
.comment .comment-state {
  max-width: 100%;
  overflow-wrap: anywhere;
}
.comment.is-pending {
  border-style: solid;
  border-color: rgba(255,201,40,.55);
  background: rgba(52,39,13,.68);
}
.comment.is-failed {
  border: 1px solid rgba(255,112,112,.5);
  background: rgba(58,20,24,.7);
}

.comment-status {
  z-index: 8;
  bottom: calc(var(--live-hot-bottom, 70px) + var(--live-hot-height, 60px) + 210px + 8px);
  max-width: calc(100% - 16px);
  min-height: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
  box-sizing: border-box;
  transition: opacity .16s ease, transform .16s ease;
}
.comment-status[hidden] { display: none !important; }
.comment-status[data-state="info"] {
  color: rgba(255,255,255,.9);
  border-color: rgba(255,255,255,.2);
}

.sheet {
  min-height: 0;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}
.sheet-head {
  gap: 12px;
}
.sheet-head h2 {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.products {
  min-width: 0;
}
.product {
  position: relative;
  display: grid;
  min-width: 0;
  grid-template-columns: 86px minmax(0, 1fr) auto;
  gap: 12px;
  min-height: 114px;
  padding: 14px 0;
  align-items: stretch;
}
.product-img {
  position: relative;
  left: auto;
  top: auto;
  min-width: 0;
  min-height: 0;
  width: 86px;
  height: 86px;
  overflow: hidden;
  align-self: start;
  aspect-ratio: 1;
  line-height: normal;
}
.product-img img {
  min-width: 0;
  min-height: 0;
  object-position: center;
}
.product-copy {
  min-width: 0;
  overflow: hidden;
}
.product-copy h3,
.product-copy p {
  width: auto;
}
.product-copy h3 {
  display: -webkit-box;
  min-width: 0;
  min-height: 2.45em;
  margin-top: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.22;
}
.product-copy p {
  min-width: 0;
  min-height: 2.9em;
  margin-bottom: 7px;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.45;
}
.product-price-row {
  min-width: 0;
  align-items: baseline;
  gap: 4px;
}
.product-price-row .price,
.product-live-price,
.product-stock,
.product-copy .sales-count {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.product-price-row .price {
  font-size: 17px;
  line-height: 1.2;
}
.product-live-price {
  max-width: 100%;
  line-height: 1.3;
}
.product-stock,
.product-copy .sales-count {
  line-height: 1.35;
}
.product-action {
  min-width: 0;
  align-self: stretch;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
}
.product .buy {
  position: static;
  flex: 0 0 auto;
  min-width: 58px;
  max-width: 72px;
  height: auto;
  min-height: 34px;
  padding: 0 11px;
  line-height: 1.2;
  white-space: normal;
  overflow-wrap: anywhere;
}

@media (max-width: 390px) {
  .comments {
    left: 8px;
    right: 58px;
    max-height: min(190px, 29svh);
  }
  .comment-status {
    left: 8px;
    right: 8px;
    bottom: calc(var(--live-hot-bottom, 70px) + var(--live-hot-height, 60px) + 190px + 8px);
    max-width: none;
    padding: 5px 8px;
  }
  .products { padding-left: 12px; padding-right: 12px; }
  .product {
    display: grid;
    grid-template-columns: 70px minmax(0, 1fr) auto;
    gap: 8px;
    padding: 12px 0;
  }
  .product-img { width: 70px; height: 70px; }
  .product-copy h3 { font-size: 14px; }
  .product-copy p { font-size: 11px; }
  .product .buy {
    min-width: 52px;
    max-width: 62px;
    padding-left: 8px;
    padding-right: 8px;
    font-size: 13px;
  }
}

.room:has(#lectureCard:not([hidden])) .comment-status {
  bottom: calc(var(--live-hot-bottom, 70px) + var(--live-hot-height, 60px) + 210px + 190px + 8px);
}

@media (max-width: 390px) {
  .room:has(#lectureCard:not([hidden])) .comment-status {
    bottom: calc(var(--live-hot-bottom, 70px) + var(--live-hot-height, 60px) + 190px + 190px + 8px);
  }
}

@media (max-width: 359px) {
  .comments { right: 54px; }
  .comment { font-size: 13px; }
  .products { padding-left: 10px; padding-right: 10px; }
  .product {
    display: grid;
    grid-template-columns: 60px minmax(0, 1fr) auto;
    gap: 7px;
  }
  .product-img { width: 60px; height: 60px; }
  .product-copy h3 { min-height: 2.55em; font-size: 13px; }
  .product-copy p { min-height: 3em; font-size: 11px; }
  .product .buy {
    min-width: 50px;
    max-width: 56px;
    padding-left: 6px;
    padding-right: 6px;
    font-size: 12px;
  }
}
