:root {
  --forest: #4A7C59;
  --mint: #36E09E;
  --violet: #6366F1;
  --purple: #7E22CE;
  --soft-gray: #F0F2F0;
  --text: #333333;
  --muted: #6F756F;
  --border: rgba(74, 124, 89, 0.14);
  --shadow: 0 16px 40px rgba(74, 124, 89, 0.08);
  --shadow-hover: 0 22px 50px rgba(74, 124, 89, 0.12);
  --radius: 16px;
  --sidebar-width: 240px;
  --sidebar-collapsed: 80px;
  --container: 1200px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

/* ===== Global Animated Background ===== */
#bg-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  /* 午后书屋主题：纯 CSS 暖色渐变，无任何外部图片依赖 */
  background-color: #f4ede0;
  background-image:
    radial-gradient(ellipse 60% 45% at 88% 8%, rgba(201, 168, 76, 0.20) 0%, rgba(201, 168, 76, 0) 100%),
    radial-gradient(ellipse 55% 50% at 4% 96%, rgba(74, 124, 89, 0.16) 0%, rgba(74, 124, 89, 0) 100%),
    radial-gradient(ellipse 70% 40% at 50% 0%, rgba(246, 240, 227, 0.85) 0%, rgba(246, 240, 227, 0) 100%),
    linear-gradient(160deg, #f8f2e6 0%, #f2e8d7 42%, #eadfc9 100%);
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  background-repeat: no-repeat;
}

body {
  margin: 0;
  /* 自托管 Noto Sans SC，并保留系统中文黑体作为兜底 */
  font-family: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    "Source Han Sans SC", "Noto Sans CJK SC", sans-serif;
  background: #f4ede0; /* warm cream fallback */
  color: var(--text);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(900px 700px at 85% 15%, rgba(201, 168, 76, 0.10), transparent 60%),
    radial-gradient(700px 500px at 0% 95%, rgba(74, 124, 89, 0.10), transparent 55%);
  animation: bgAurora 16s ease-in-out infinite alternate;
}

@keyframes bgAurora {
  0%   { transform: translate(0, 0) scale(1);     opacity: 0.9; }
  50%  { transform: translate(1.5%, 1%) scale(1.04); opacity: 1;   }
  100% { transform: translate(-1%, 2%) scale(0.98);  opacity: 0.85;}
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

.app-shell {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  padding: 20px 16px;
  background: rgba(252, 247, 236, 0.78);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  border-right: 1px solid rgba(255, 255, 255, 0.65);
  overflow-y: auto;
  z-index: 20;
  transition: width 0.25s ease;
}

.workspace {
  position: relative;
  flex: 1;
  margin-left: var(--sidebar-width);
  transition: margin-left 0.25s ease;
  z-index: 1;
}

body.sidebar-collapsed .sidebar {
  width: var(--sidebar-collapsed);
}

body.sidebar-collapsed .workspace {
  margin-left: var(--sidebar-collapsed);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
  padding: 8px;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 20px;
  background: linear-gradient(135deg, var(--forest), var(--mint));
  box-shadow: var(--shadow);
  flex-shrink: 0;
}

.brand-copy h1 {
  margin: 0 0 4px;
  font-size: 22px;
}

.brand-copy p,
.group-title,
.breadcrumb span,
.section-tag,
.book-meta,
.small,
.site-footer span,
.site-footer a {
  color: var(--muted);
}

.brand-copy p {
  margin: 0;
  font-size: 12px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.group-title {
  font-size: 12px;
  padding: 0 12px;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 0 14px;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  transition: 0.2s ease;
}

.nav-item i {
  width: 20px;
  text-align: center;
  color: var(--forest);
}

.nav-item:hover,
.nav-item.active {
  background: linear-gradient(135deg, rgba(74, 124, 89, 0.12), rgba(54, 224, 158, 0.08));
  box-shadow: inset 0 0 0 1px rgba(74, 124, 89, 0.08);
}

.nav-badge {
  margin-left: auto;
  font-style: normal;
  min-width: 24px;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(54, 224, 158, 0.18);
  color: var(--forest);
  font-size: 12px;
}

.nav-badge.danger {
  background: rgba(126, 34, 206, 0.12);
  color: var(--purple);
}

body.sidebar-collapsed .brand-copy,
body.sidebar-collapsed .group-title,
body.sidebar-collapsed .nav-item span,
body.sidebar-collapsed .nav-badge {
  display: none;
}

body.sidebar-collapsed .nav-item {
  justify-content: center;
  padding: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 20px;
  justify-content: space-between;
  padding: 18px 28px;
  background: rgba(252, 247, 236, 0.78);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.65);
}

/* 顶栏只在 首页/书籍分类/畅销排行 三个视图悬浮，其他视图隐藏 */
.topbar.hidden {
  display: none;
}

.topbar-left,
.topbar-right,
.topbar-center {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-center {
  flex: 1;
  justify-content: center;
}

.breadcrumb strong {
  display: block;
  font-size: 18px;
}

.icon-btn,
.user-trigger,
.pay-method,
.tab,
.pill-switch,
.text-btn,
.carousel-dot {
  border-radius: var(--radius);
}

.icon-btn {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  background: #fff;
  box-shadow: var(--shadow);
  color: var(--forest);
}

.badge-btn {
  position: relative;
}

.badge-btn em {
  position: absolute;
  top: 6px;
  right: 6px;
  font-style: normal;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--violet), var(--purple));
  color: #fff;
  font-size: 11px;
}

.search-field {
  position: relative;
  width: 360px;
}

.search-field i {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
}

.search-field input,
.filter-row select,
.form-grid input,
.form-grid select,
.form-grid textarea,
.chat-input input {
  width: 100%;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.94);
  border-radius: var(--radius);
  padding: 14px 14px 14px 44px;
  outline: none;
  transition: 0.2s ease;
}

.filter-row {
  display: flex;
  gap: 10px;
}

.filter-row select,
.form-grid input,
.form-grid select,
.form-grid textarea,
.chat-input input {
  padding: 14px 16px;
}

.search-field input:focus,
.filter-row select:focus,
.form-grid input:focus,
.form-grid select:focus,
.form-grid textarea:focus,
.chat-input input:focus {
  border-color: rgba(54, 224, 158, 0.5);
  box-shadow: 0 0 0 4px rgba(54, 224, 158, 0.12);
}

.ai-btn,
.primary-btn,
.ghost-btn,
.text-btn {
  padding: 14px 18px;
  font-weight: 600;
}

.ai-btn,
.primary-btn {
  color: #fff;
  background: linear-gradient(135deg, var(--violet), var(--purple));
  box-shadow: 0 16px 30px rgba(99, 102, 241, 0.22);
}

.primary-btn.forest {
  background: linear-gradient(135deg, var(--forest), var(--mint));
}

.ghost-btn,
.text-btn,
.pay-method,
.tab,
.pill-switch {
  background: #fff;
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(74, 124, 89, 0.1);
}

.ghost-btn:hover,
.text-btn:hover,
.pay-method:hover,
.tab:hover,
.pill-switch:hover,
.primary-btn:hover,
.ai-btn:hover,
.icon-btn:hover,
.user-trigger:hover,
.carousel-dot:hover {
  transform: translateY(-1px);
}

.user-menu {
  position: relative;
}

.user-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px 8px 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.user-trigger img,
.seller-card img,
.profile-card img {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: rgba(54, 224, 158, 0.08);
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 150px;
  padding: 8px;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-hover);
  display: none;
}

.user-dropdown.open {
  display: block;
}

.user-dropdown button {
  width: 100%;
  text-align: left;
  padding: 12px;
  border-radius: 12px;
  background: transparent;
}

.user-dropdown button:hover {
  background: var(--soft-gray);
}

.main-area {
  padding: 28px;
}

.content-wrap {
  max-width: var(--container);
  margin: 0 auto;
  display: grid;
}

.view {
  display: none;
  gap: 24px;
}

.view.active {
  display: grid;
}

.hero-panel,
.section-block,
.service-strip,
.site-footer,
.panel-card,
.rank-row,
.seller-item,
.cart-item,
.order-card,
.playlist-card,
.history-item,
.faq-list article,
.settings-list article {
  background: rgba(252, 247, 236, 0.76);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 10px 32px rgba(120, 90, 60, 0.08);
}

.hero-panel,
.section-block,
.service-strip,
.site-footer {
  border-radius: 24px;
  padding: 24px;
}

.hero-panel {
  display: grid;
  grid-template-columns: 1.2fr 0.9fr;
  gap: 22px;
  background:
    linear-gradient(135deg, rgba(74, 124, 89, 0.96), rgba(54, 224, 158, 0.84)),
    #fff;
  color: #fff;
}

.eyebrow,
.section-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  margin-bottom: 12px;
}

.hero-copy h2 {
  margin: 0 0 14px;
  font-size: 40px;
  line-height: 1.2;
}

.hero-copy p {
  margin: 0;
  max-width: 680px;
  color: rgba(255, 255, 255, 0.86);
}

.hero-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.hero-actions .primary-btn {
  background: #fff;
  color: var(--forest);
  box-shadow: none;
}

.hero-actions .ghost-btn {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
}

.hero-side {
  display: grid;
  gap: 16px;
}

.hero-card {
  border-radius: 22px;
  padding: 20px;
  min-height: 150px;
}

.hero-card-primary {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.92), rgba(126, 34, 206, 0.86));
}

.hero-card-secondary {
  padding: 0;
  overflow: hidden;
}

.hero-card-secondary img {
  width: 100%;
  height: 190px;
  object-fit: cover;
}

.stats-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  padding: 20px 24px;
  border-radius: 24px;
  background: linear-gradient(135deg, var(--forest), #5a936c);
  color: #fff;
  box-shadow: var(--shadow);
}

.stats-strip article {
  text-align: center;
}

.stats-strip strong {
  display: block;
  font-size: 30px;
  margin-bottom: 6px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.section-head h3 {
  margin: 0;
  font-size: 28px;
}

.section-head .section-tag {
  margin-bottom: 8px;
  background: rgba(74, 124, 89, 0.08);
}

.promo-carousel {
  position: relative;
  min-height: 360px;
}

.promo-slide {
  display: none;
  grid-template-columns: 1.1fr 0.8fr;
  gap: 24px;
  padding: 24px;
  border-radius: 24px;
  color: #fff;
  overflow: hidden;
}

.promo-slide.active {
  display: grid;
}

.promo-copy h4 {
  margin: 8px 0 10px;
  font-size: 34px;
}

.promo-copy p {
  margin: 0 0 16px;
  max-width: 560px;
  color: rgba(255, 255, 255, 0.9);
}

.promo-pricing {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.promo-pricing strong,
.current-price {
  font-size: 34px;
  color: #fff;
}

.promo-pricing del,
.original-price {
  color: rgba(255, 255, 255, 0.72);
}

.promo-discount {
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
}

.promo-visual {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  border-radius: 20px;
}

.promo-visual img {
  width: 100%;
  max-width: 260px;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 20px;
  box-shadow: 0 22px 40px rgba(0, 0, 0, 0.18);
}

.carousel-controls {
  display: flex;
  gap: 10px;
}

.carousel-dot {
  width: 40px;
  height: 12px;
  background: var(--soft-gray);
}

.carousel-dot.active {
  background: linear-gradient(135deg, var(--forest), var(--mint));
}

.category-grid,
.book-grid,
.profile-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.category-card,
.book-card,
.panel-card,
.playlist-card,
.seller-item,
.history-item {
  border-radius: 20px;
  overflow: hidden;
}

.category-card,
.book-card,
.playlist-card,
.seller-item,
.history-item,
.cart-item,
.order-card,
.rank-row {
  transition: 0.2s ease;
}

.category-card:hover,
.book-card:hover,
.playlist-card:hover,
.seller-item:hover,
.history-item:hover,
.cart-item:hover,
.order-card:hover,
.rank-row:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.category-card {
  padding: 18px;
  background: linear-gradient(180deg, #fff, rgba(240, 242, 240, 0.88));
  box-shadow: var(--shadow);
}

.category-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  margin-bottom: 16px;
  color: var(--forest);
  background: linear-gradient(135deg, rgba(74, 124, 89, 0.12), rgba(54, 224, 158, 0.12));
}

/* 分类卡片可点击，悬停反馈 */
.category-card[data-category] {
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.category-card[data-category]:hover {
  transform: translateY(-4px);
  border-color: rgba(74, 124, 89, 0.45);
  box-shadow: 0 14px 30px rgba(31, 61, 46, 0.14);
}

.category-go {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--forest);
}

.category-card[data-category]:hover .category-go i {
  transform: translateX(4px);
  transition: transform 0.2s ease;
}

.category-card h4,
.book-info h4,
.playlist-body h4,
.panel-card h4 {
  margin: 0 0 8px;
}

.service-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.96), rgba(126, 34, 206, 0.92));
}

.service-item {
  color: #fff;
  padding: 10px 8px;
}

.service-item i {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  margin-bottom: 12px;
  background: rgba(255, 255, 255, 0.12);
}

.book-card {
  position: relative;
  background: #fff;
  box-shadow: var(--shadow);
}

.book-cover-wrap {
  position: relative;
  height: 290px;
  overflow: hidden;
}

.book-cover-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.25s ease;
}

.book-card:hover .book-cover-wrap img {
  transform: scale(1.04);
}

/* 书籍分类标签（封面左下角 chip） */
.cat-tag {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: #245c3c;
  background: rgba(250, 250, 249, 0.92);
  border: 1px solid rgba(74, 124, 89, 0.35);
  box-shadow: 0 2px 8px rgba(31, 61, 46, 0.18);
  pointer-events: none;
}

.cat-tag i {
  font-size: 11px;
}

.book-chip,
.condition-chip,
.stock-tag,
.mini-chip-row span {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-size: 12px;
}

.book-chip,
.condition-chip {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 1;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.9);
}

.condition-chip {
  left: auto;
  right: 14px;
  color: var(--forest);
}

.book-info {
  padding: 18px;
}

.book-info .book-meta {
  font-size: 13px;
  margin-bottom: 10px;
}

.book-rating-line,
.book-bottom,
.detail-meta,
.detail-actions,
.seller-card,
.mini-chip-row,
.summary-line,
.order-meta,
.playlist-meta,
.chat-input {
  display: flex;
  align-items: center;
  gap: 10px;
}

.book-rating-line {
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 14px;
  color: var(--muted);
}

.book-bottom {
  justify-content: space-between;
}

.book-bottom strong,
.summary-total strong {
  color: var(--forest);
  font-size: 24px;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  justify-content: center;
}

.detail-layout,
.dual-column,
.cart-layout {
  display: grid;
  gap: 24px;
}

.detail-layout {
  grid-template-columns: 0.9fr 1.1fr;
}

.detail-main-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 22px;
  margin-bottom: 0;
}

.detail-thumbs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.detail-thumbs > * {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
}

.detail-thumbs img {
  height: 120px;
  width: 100%;
  object-fit: cover;
  border-radius: 16px;
  border: 2px solid transparent;
  cursor: pointer;
}

.detail-thumbs img.active {
  border-color: rgba(54, 224, 158, 0.6);
}

.detail-meta {
  flex-wrap: wrap;
  margin: 16px 0;
}

.detail-meta span,
.stock-tag,
.mini-chip-row span {
  padding: 8px 12px;
  background: rgba(74, 124, 89, 0.08);
}

.price-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 20px 0;
  padding: 18px 20px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(74, 124, 89, 0.1), rgba(54, 224, 158, 0.1));
}

.detail-panels {
  display: grid;
  gap: 16px;
}

.detail-panels article,
.address-card,
.scan-card,
.summary-card,
.faq-list article,
.settings-list article,
.chat-box,
.playlist-card {
  border-radius: 20px;
  padding: 18px;
  background: rgba(249, 250, 249, 0.9);
}

.review-list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.rank-table,
.order-list,
.seller-cards,
.cart-list,
.history-list,
.playlist-list {
  display: grid;
  gap: 16px;
}

.rank-row,
.order-card,
.seller-item,
.cart-item,
.history-item {
  display: grid;
  gap: 16px;
  padding: 18px;
  border-radius: 20px;
}

.rank-row {
  grid-template-columns: 70px 76px 1fr auto auto;
  align-items: center;
}

/* —— 排行/购物车/卖书/订单/历史 封面 img 尺寸改为由其独立包裹容器 .row-cover 决定 ——
   .row-cover 就是第2列（或第1列，具体取决于容器 grid-template-columns）的 grid-item。
   原先我们对 img 直接写 width/height；现在 img 填 .row-cover。 */
.rank-row img,
.cart-item img,
.order-book img,
.history-item img,
.seller-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 14px;
  display: block;
}

/* —— 排行/购物车/卖书/订单/历史 用 .row-cover 作为封面独立容器 ——
   把 img 单独包在 span.row-cover 内，尺寸锁定，与整行其他列互不影响 */
.row-cover {
  position: relative;
  display: block;
  /* 关键：row-cover 的尺寸必须完全匹配原先 img 的独立 76×104（cart/seller 88×118）
     且作为 grid-item 不能被父容器压缩；用 min-width/min-height 锁尺寸 */
  width: 76px;
  min-width: 76px;
  max-width: 76px;
  height: 104px;
  min-height: 104px;
  max-height: 104px;
  overflow: hidden;
  border-radius: 14px;
  align-self: center;
  justify-self: start;
}
/* 不同容器列宽的 span 的大小修正 */
.cart-item > .row-cover,
.seller-item > .row-cover,
.history-item > .row-cover {
  width: 88px;
  min-width: 88px;
  max-width: 88px;
  height: 118px;
  min-height: 118px;
  max-height: 118px;
}
.order-book > .row-cover {
  width: 76px;
  min-width: 76px;
  max-width: 76px;
  height: 104px;
  min-height: 104px;
  max-height: 104px;
}



.rank-index {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--forest), var(--mint));
  color: #fff;
  font-weight: 700;
}

.playlist-card img {
  width: 100%;
  height: 210px;
  object-fit: cover;
  border-radius: 18px;
  display: block;
}

.playlist-body {
  padding-top: 16px;
}

.playlist-meta {
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
}

.dual-column {
  grid-template-columns: repeat(2, 1fr);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.form-grid textarea,
.upload-box,
.primary-btn.full {
  grid-column: 1 / -1;
}

.upload-box {
  min-height: 140px;
  border: 1px dashed rgba(74, 124, 89, 0.28);
  border-radius: 20px;
  display: grid;
  place-items: center;
  gap: 10px;
  background: rgba(249, 250, 249, 0.9);
  color: var(--muted);
}

.scan-card {
  display: grid;
  gap: 16px;
}

.scan-box {
  display: grid;
  place-items: center;
  min-height: 240px;
  border-radius: 20px;
  background:
    linear-gradient(135deg, rgba(74, 124, 89, 0.9), rgba(54, 224, 158, 0.6)),
    #fff;
  color: #fff;
  font-size: 80px;
}

.tab-row,
.pay-methods {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.tab,
.pay-method,
.pill-switch {
  padding: 10px 16px;
}

.tab.active,
.pay-method.active,
.pill-switch.active {
  background: linear-gradient(135deg, rgba(74, 124, 89, 0.14), rgba(54, 224, 158, 0.12));
  color: var(--forest);
}

.seller-item {
  grid-template-columns: 88px 1fr auto;
  align-items: center;
}

.cart-layout {
  grid-template-columns: 1.2fr 0.8fr;
}

.cart-item {
  grid-template-columns: 88px 1fr auto auto;
  align-items: center;
}

.summary-card {
  display: grid;
  gap: 14px;
  margin-bottom: 16px;
}

.summary-line {
  justify-content: space-between;
  color: var(--muted);
}

.summary-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  border-top: 1px solid rgba(74, 124, 89, 0.1);
}

.address-card {
  margin-bottom: 14px;
  border: 2px solid transparent;
}

.address-card.active {
  border-color: rgba(54, 224, 158, 0.55);
}

.order-card {
  gap: 14px;
}

.order-meta {
  justify-content: space-between;
  color: var(--muted);
  flex-wrap: wrap;
}

.order-book {
  display: flex;
  gap: 14px;
}

.order-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.profile-grid {
  margin-bottom: 24px;
}

.profile-card {
  display: flex;
  align-items: center;
  gap: 14px;
}

.panel-card {
  padding: 18px;
}

.history-item {
  grid-template-columns: 88px 1fr auto;
  align-items: center;
}

.chat-box {
  display: grid;
  gap: 12px;
}

.chat-message {
  max-width: 80%;
  padding: 14px 16px;
  border-radius: 18px;
  line-height: 1.6;
}

.chat-message.inbound {
  background: rgba(74, 124, 89, 0.08);
}

.chat-message.outbound {
  margin-left: auto;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.14), rgba(126, 34, 206, 0.16));
}

.chat-input {
  margin-top: 8px;
}

.chat-input input {
  padding-left: 16px;
}

.faq-list,
.settings-list {
  display: grid;
  gap: 12px;
}

.settings-list article {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(120px);
  padding: 14px 18px;
  border-radius: 16px;
  background: rgba(51, 51, 51, 0.92);
  color: #fff;
  box-shadow: var(--shadow-hover);
  opacity: 0;
  pointer-events: none;
  transition: 0.24s ease;
  z-index: 100;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===== Nebula View ===== */
#view-nebula {
  display: none;
  gap: 16px;
}
#view-nebula.active {
  display: grid;
}

.nebula-header {
  background: rgba(10, 10, 26, 0.95);
  border-radius: 24px;
  padding: 20px 24px;
  color: #fff;
}

.nebula-header .section-head {
  margin-bottom: 0;
}

.nebula-header .section-head h3 {
  color: #c8d6e5;
}

.nebula-header .section-tag {
  background: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
}

.nebula-legend {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 13px;
  color: #8395a7;
  flex-wrap: wrap;
}

.legend-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
}

.legend-dot.author-dot {
  background: radial-gradient(circle, #a5b4fc, #6366F1);
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.5);
}

.legend-dot.book-dot {
  background: radial-gradient(circle, #88e0b0, #4A7C59);
  box-shadow: 0 0 6px rgba(74, 124, 89, 0.4);
}

.nebula-hint {
  opacity: 0.6;
  font-size: 12px;
}

#nebula-container {
  position: relative;
  width: 100%;
  height: 680px;
  border-radius: 24px;
  overflow: hidden;
  background: #0a0a1a;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.3);
}

#nebula-container canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.nebula-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #8395a7;
  gap: 16px;
}

.nebula-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(99, 102, 241, 0.15);
  border-top-color: #6366F1;
  border-radius: 50%;
  animation: nebula-spin 1s linear infinite;
}

@keyframes nebula-spin {
  to { transform: rotate(360deg); }
}

.nebula-error {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #8395a7;
  gap: 8px;
}

.nebula-error i {
  font-size: 48px;
  color: #6366F1;
  margin-bottom: 8px;
}

.nebula-error h3 {
  margin: 0;
  color: #c8d6e5;
}

.nebula-error-hint {
  font-size: 12px;
  opacity: 0.6;
}

/* Nebula Popup */
.nebula-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 420px;
  max-width: 90vw;
  background: rgba(20, 20, 40, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 24px;
  padding: 24px;
  z-index: 1000;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
  color: #e0e6ed;
  transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1), transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.nebula-popup.hidden {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.85) translateY(10px);
  pointer-events: none;
}

.nebula-popup:not(.hidden) {
  animation: nebula-popup-in 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes nebula-popup-in {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.85) translateY(10px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1) translateY(0);
  }
}

/* 没有本地封面的著作使用的占位块 */
.nebula-popup-content .cover-placeholder {
  display: grid;
  place-items: center;
  width: 110px;
  height: 160px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--violet), var(--purple));
  font-size: 40px;
  color: #fff;
  flex-shrink: 0;
}

.nebula-popup-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #8395a7;
  border: none;
  cursor: pointer;
  transition: 0.2s;
}

.nebula-popup-close:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.nebula-popup-content {
  display: flex;
  gap: 18px;
}

.nebula-popup-content img {
  width: 110px;
  height: 160px;
  object-fit: cover;
  border-radius: 14px;
  flex-shrink: 0;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
  display: block;
}

.nebula-popup-info {
  flex: 1;
  min-width: 0;
}

.nebula-popup-info h4 {
  margin: 0 0 6px;
  font-size: 20px;
  color: #fff;
}

.nebula-popup-type {
  display: inline-block;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
  margin: 0 0 12px;
}

.nebula-popup-desc {
  font-size: 14px;
  line-height: 1.6;
  color: #a0aec0;
  margin: 0 0 12px;
}

.nebula-popup-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  color: #64748b;
}

.nebula-popup-meta span {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
}

/* =========================================================
 * 备注：书籍封面已全部替换为本地真实出版封面（images/covers/）。
 * ========================================================= */

/* 详情页画廊 */
.detail-gallery { position: relative; }
.detail-main-wrap {
  display: block;
  position: relative;
  width: 100%;
  height: 520px;
  margin-bottom: 16px;
  overflow: hidden;
  border-radius: 22px;
}

.detail-thumbs > span {
  display: block;
  overflow: hidden;
}


@media (max-width: 1080px) {
  #nebula-container {
    height: 480px;
  }
  .nebula-popup-content {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
}

@media (max-width: 1440px) {
  .topbar {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .topbar-center {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .search-field {
    width: 300px;
  }

  .category-grid,
  .book-grid,
  .profile-grid,
  .service-strip {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 1080px) {
  .sidebar {
    width: 80px;
  }

  .workspace {
    margin-left: 80px;
  }

  .brand-copy,
  .group-title,
  .nav-item span,
  .nav-badge {
    display: none;
  }

  .nav-item {
    justify-content: center;
    padding: 0;
  }

  .hero-panel,
  .promo-slide,
  .detail-layout,
  .dual-column,
  .cart-layout,
  .category-grid,
  .book-grid,
  .profile-grid,
  .service-strip {
    grid-template-columns: 1fr;
  }

  .rank-row,
  .cart-item,
  .seller-item,
  .history-item {
    grid-template-columns: 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .sidebar,
  .workspace {
    position: static;
    width: 100%;
    margin-left: 0;
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid rgba(74, 124, 89, 0.08);
  }

  .topbar,
  .main-area {
    padding: 16px;
  }

  .hero-copy h2,
  .section-head h3 {
    font-size: 24px;
  }

  .stats-strip {
    grid-template-columns: repeat(2, 1fr);
  }
}
