* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
.file-protocol-tip {
  background: #c62828;
  color: #fff;
  padding: 10px 16px;
  text-align: center;
  font-size: 14px;
  z-index: 9999;
}
.file-protocol-tip a {
  color: #ffeb3b;
  text-decoration: underline;
}

:root {
  --primary: #e53935;
  --primary-dark: #c62828;
  --bg-dark: #1a1a1a;
  --bg-card: rgba(30, 30, 30, 0.95);
  --text: #fff;
  --text-muted: rgba(255, 255, 255, 0.8);
  --border: rgba(255, 255, 255, 0.15);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg-dark);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

.app {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* 顶部栏 */
.header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.6), transparent);
}

.header-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.live-badge {
  font-size: 14px;
  font-weight: 600;
}

.viewer-count {
  font-size: 12px;
  opacity: 0.95;
}

.report-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* 主内容区：顶栏与底栏之间尽量占满视口，视频横竖屏均 object-fit: cover 铺满 */
.main {
  flex: 1;
  position: relative;
  aspect-ratio: unset;
  max-height: none;
  min-height: calc(100vh - 64px);
  min-height: calc(100dvh - 64px);
  width: 100%;
  background: #000;
}

.video-container {
  position: absolute;
  inset: 0;
  background: #111;
  min-height: 100%;
}

#video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
}
.video-cover {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #111;
}

.video-overlay {
  position: absolute;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}

.video-overlay.promo {
  top: 50px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: white;
}

.video-overlay.countdown {
  top: 50px;
  right: 16px;
  background: var(--primary);
  color: white;
}

.video-overlay.stream-status {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.75);
  padding: 12px 20px;
  font-size: 14px;
}

.video-overlay.stream-status-wrap {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  background: rgba(0,0,0,0.75);
  padding: 16px 20px;
  font-size: 14px;
}
.stream-retry-btn {
  padding: 8px 20px;
  border: none;
  border-radius: 6px;
  background: #e53935;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
}
.stream-retry-btn:hover {
  background: #c62828;
}

.video-overlay.video-play-btn {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(0,0,0,0.75);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 14px 28px;
  border-radius: 8px;
}
.video-overlay.video-play-btn:hover {
  background: rgba(0,0,0,0.85);
}

/* 左侧活动流 */
.activity-feed {
  position: absolute;
  left: 8px;
  bottom: 80px;
  width: 70%;
  max-width: 260px;
  max-height: 45%;
  overflow: hidden;
  pointer-events: none;
}

.activity-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 0;
}

.activity-item {
  background: rgba(0, 0, 0, 0.5);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.4;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.activity-item.purchase {
  border-left: 3px solid var(--primary);
}

.activity-item .user {
  color: #ffd54f;
  margin-right: 4px;
}

/* 右侧商品卡片 */
.product-card {
  position: absolute;
  right: 8px;
  bottom: 80px;
  width: 140px;
  background: var(--bg-card);
  border-radius: 8px;
  padding: 10px;
  border: 1px solid var(--border);
}

.product-card img {
  width: 100%;
  height: 80px;
  object-fit: contain;
  border-radius: 4px;
  margin-bottom: 6px;
  border:1px solid #333;
}

.product-card h3 {
  font-size: 13px;
  margin-bottom: 4px;
  line-height: 1.3;
}

.features {
  list-style: none;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.features li::before {
  content: "• ";
  color: var(--primary);
}

.specs, .benefits {
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.price {
  font-size: 18px;
  color: var(--primary);
  font-weight: 700;
  margin: 6px 0;
}

.buy-btn {
  width: 100%;
  padding: 8px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.buy-btn:hover {
  background: var(--primary-dark);
}

.buy-btn:active {
  transform: scale(0.98);
}

/* 底部栏 */
.footer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 10px 12px;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  z-index: 10;
}

#chatInput {
  flex: 0 1 auto;
  min-width: 0;
  max-width: min(38vw, 148px);
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  font-size: 14px;
  outline: none;
}

.footer #sendBtn {
  white-space: nowrap;
  flex-shrink: 0;
  font-size: 14px;
  padding: 4px 2px;
}

/* 小黄车、订单、点赞靠右 */
.footer-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  flex-shrink: 0;
}

#chatInput::placeholder {
  color: var(--text-muted);
}

.icon-btn {
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  flex-shrink: 0;
}

.icon-btn:hover {
  opacity: 0.8;
}
#cartBtn {
  position: relative;
}
/* 小黄车按钮（手机窄屏与输入框并排时略小，避免挤压文字换行） */
.xiaohuangche-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  flex-shrink: 0;
  background: linear-gradient(180deg, #FFD54F 0%, #FFC107 100%);
  color: #5D4037;
  font-size: 17px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(255, 193, 7, 0.35);
}
.xiaohuangche-btn:hover {
  background: linear-gradient(180deg, #FFE082 0%, #FFD54F 100%);
  box-shadow: 0 3px 12px rgba(255, 193, 7, 0.5);
}
.cart-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 14px;
  height: 14px;
  padding: 0 3px;
  background: #E65100;
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 购买弹窗 */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.6);
  align-items: flex-end;
  justify-content: center;
}
.modal.show {
  display: flex;
}
.modal-content {
  background: #2a2a2a;
  border-radius: 16px 16px 0 0;
  width: 100%;
  max-width: 430px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.modal-header h3 {
  font-size: 18px;
  font-weight: 600;
}
.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}
.address-prompt, .address-info {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px;
  background: rgba(229, 57, 53, 0.15);
  border-radius: 8px;
  margin-bottom: 12px;
}
.address-prompt a, .address-info a {
  color: var(--primary);
  text-decoration: none;
  font-size: 14px;
}
.address-icon {
  font-size: 16px;
}
.modal-product {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.modal-product img {
  width: 80px;
  height: 100px;
  object-fit: contain;
  border-radius: 8px;
  background: #111;
}
.modal-product-info {
  flex: 1;
  min-width: 0;
}
.modal-product-name {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 4px;
}
.modal-product-specs {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.modal-price {
  font-size: 20px;
  color: var(--primary);
  font-weight: 700;
  margin-bottom: 6px;
}
.quantity-selector {
  display: flex;
  align-items: center;
  gap: 12px;
}
.quantity-selector button {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #333;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.quantity-selector span {
  font-size: 16px;
  min-width: 24px;
  text-align: center;
}
.modal-buy-btn {
  width: 100%;
  padding: 14px;
  margin-top: 16px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}
.modal-buy-btn:disabled {
  background: #666;
  cursor: not-allowed;
}
.modal-buy-btn:not(:disabled):active {
  transform: scale(0.98);
}
.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}
.modal-actions .modal-buy-btn {
  flex: 1;
  margin-top: 0;
}
.modal-add-cart-btn {
  flex: 1;
  padding: 14px;
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 0;
}
.modal-add-cart-btn:hover {
  background: rgba(229, 57, 53, 0.1);
}
.modal-add-cart-btn:active {
  transform: scale(0.98);
}

/* 小黄车 / 购物车弹窗 */
.modal-cart .modal-content {
  display: flex;
  flex-direction: column;
  max-height: 70vh;
}
.modal-xiaohuangche .modal-content {
  max-height: 80vh;
}
.xiaohuangche-title {
  color: #5D4037;
  font-weight: 700;
}
.shelf-section {
  margin-bottom: 16px;
}
.shelf-section-title,
.my-cart-section .shelf-section-title {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 10px;
  font-weight: 600;
}
.cart-count-label {
  font-weight: 400;
  color: var(--primary);
}
.shelf-product-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 36vh;
  overflow-y: auto;
  margin: 0 -16px;
  padding: 0 16px;
}
.shelf-product-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  align-items: center;
}
.shelf-product-item:last-child {
  border-bottom: none;
}
.shelf-product-item img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  border-radius: 8px;
  background: #111;
  flex-shrink: 0;
}
.shelf-product-info {
  flex: 1;
  min-width: 0;
}
.shelf-product-name {
  font-size: 14px;
  margin-bottom: 4px;
  line-height: 1.3;
}
.shelf-product-price {
  font-size: 16px;
  color: var(--primary);
  font-weight: 700;
}
.shelf-product-item .shelf-buy-btn {
  flex-shrink: 0;
  padding: 8px 16px;
  background: linear-gradient(180deg, #FFD54F 0%, #FFC107 100%);
  color: #5D4037;
  border: none;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(255, 193, 7, 0.3);
}
.shelf-product-item .shelf-buy-btn:hover {
  background: linear-gradient(180deg, #FFE082 0%, #FFD54F 100%);
}
.shelf-empty {
  text-align: center;
  padding: 24px 16px;
  color: var(--text-muted);
}
.shelf-empty-icon {
  font-size: 40px;
  display: block;
  margin-bottom: 8px;
  opacity: 0.6;
}
.shelf-empty p {
  font-size: 14px;
}
.shelf-loading {
  display: block;
  text-align: center;
  padding: 16px;
  color: var(--text-muted);
  font-size: 14px;
}
.my-cart-section {
  border-top: 1px solid var(--border);
  padding-top: 12px;
}
.cart-list {
  flex: 1;
  overflow-y: auto;
  margin: 0 -16px;
  padding: 0 16px;
}
.cart-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  align-items: center;
}
.cart-item:last-child {
  border-bottom: none;
}
.cart-item img {
  width: 60px;
  height: 75px;
  object-fit: contain;
  border-radius: 6px;
  background: #111;
  flex-shrink: 0;
}
.cart-item-info {
  flex: 1;
  min-width: 0;
}
.cart-item-name {
  font-size: 14px;
  margin-bottom: 4px;
  line-height: 1.3;
}
.cart-item-specs {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.cart-item-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.cart-item-price {
  font-size: 16px;
  color: var(--primary);
  font-weight: 700;
}
.cart-item-qty {
  font-size: 13px;
  color: var(--text-muted);
}
.cart-item-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  padding: 4px 8px;
}
.cart-item-remove:hover {
  color: var(--primary);
}
.cart-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}
.cart-empty-icon {
  font-size: 48px;
  display: block;
  margin-bottom: 12px;
  opacity: 0.5;
}
.cart-empty p {
  margin-bottom: 6px;
  font-size: 15px;
}
.cart-empty-hint {
  font-size: 13px;
  opacity: 0.8;
}
.cart-footer {
  padding-top: 16px;
  border-top: 1px solid var(--border);
  margin-top: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.cart-total {
  font-size: 16px;
  font-weight: 600;
}
.cart-total span {
  color: var(--primary);
  font-size: 20px;
}
.cart-footer .modal-buy-btn {
  margin-top: 0;
  flex-shrink: 0;
}

/* 点赞爱心飘飞效果 */
.like-hearts-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 50;
}
.like-heart {
  position: absolute;
  font-size: 28px;
  animation: likeHeartFloat 1.2s ease-out forwards;
  filter: drop-shadow(0 0 4px rgba(229, 57, 53, 0.5));
}
@keyframes likeHeartFloat {
  0% {
    opacity: 1;
    transform: translateY(0) scale(0.5);
  }
  20% {
    opacity: 1;
    transform: translateY(-20px) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-120px) scale(0.8);
  }
}
#likeBtn.liked {
  animation: likeBtnPop 0.4s ease;
}
@keyframes likeBtnPop {
  0% { transform: scale(1); }
  40% { transform: scale(1.4); }
  70% { transform: scale(0.95); }
  100% { transform: scale(1); }
}

.address-form input {
  width: 100%;
  padding: 12px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #333;
  color: #fff;
  font-size: 14px;
}
.address-form input::placeholder {
  color: var(--text-muted);
}
.modal-address .modal-content {
  padding: 20px;
}
.address-info {
  flex-wrap: wrap;
}
.address-info #addressText {
  flex: 1;
  min-width: 0;
  font-size: 13px;
}
.address-info #changeAddressLink {
  flex-shrink: 0;
}

/* 订单链接（小黄车右侧） */
.order-link {
  color: var(--text);
  font-size: 14px;
  text-decoration: none;
  padding: 4px 4px;
  display: flex;
  align-items: center;
  white-space: nowrap;
  flex-shrink: 0;
}
.order-link:hover {
  opacity: 0.9;
}

/* 订单弹窗（底部抽屉风格） */
.order-modal .modal-content {
  background: #f5f5f5;
  color: #333;
}
.order-modal-content {
  display: flex;
  flex-direction: column;
  min-height: 40vh;
  max-height: 75vh;
}
.order-sheet-handle {
  width: 36px;
  height: 4px;
  background: #ccc;
  border-radius: 2px;
  margin: 10px auto 16px;
  flex-shrink: 0;
}
.order-tabs {
  display: flex;
  gap: 0;
  padding: 0 8px 12px;
  border-bottom: 1px solid #e0e0e0;
  flex-shrink: 0;
}
.order-tab {
  flex: 1;
  padding: 8px 4px;
  background: none;
  border: none;
  font-size: 14px;
  color: #666;
  cursor: pointer;
  position: relative;
}
.order-tab.active {
  color: #333;
  font-weight: 600;
}
.order-tab.active::after {
  content: '';
  position: absolute;
  bottom: -13px;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 2px;
  background: #ff6b35;
  border-radius: 1px;
}
.order-list-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 20px 0;
  min-height: 120px;
}
.order-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.order-empty {
  text-align: center;
  padding: 48px 20px;
  color: #999;
  font-size: 15px;
}
.order-empty p {
  margin: 0;
}
.order-item {
  background: #fff;
  border-radius: 8px;
  padding: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.order-item-name { font-size: 14px; font-weight: 500; margin-bottom: 4px; color: #333; }
.order-item-meta { font-size: 12px; color: #999; margin-bottom: 6px; }
.order-item-price { font-size: 16px; color: var(--primary); font-weight: 600; }
.order-item-pay { font-size: 12px; color: #f5a623; margin-top: 4px; }

.payment-qr-modal { max-width: 320px; text-align: center; }
.payment-qr-wrap { margin: 12px auto; display: flex; justify-content: center; }
.payment-qr-wrap img { display: block; border: 1px solid #eee; border-radius: 8px; }
.payment-qr-hint { font-size: 13px; color: #666; margin: 8px 0 0; }
.payment-qr-status { font-size: 14px; color: #0a7; min-height: 1.2em; margin-top: 8px; }
.payment-qr-amount { font-size: 16px; font-weight: 600; margin: 0 0 8px; }
