/* glass.css 由页面直接引入 */

/* 隐藏滚动条，保留滚动 */
html,
body,
* {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
*::-webkit-scrollbar {
  width: 0 !important;
  height: 0 !important;
  display: none;
}

/* 减少长按/按下时左下角链接地址预览 */
a,
[data-nav],
.tile,
.cat-btn,
.detail-brand {
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
}

.shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.85rem 0.85rem 2.5rem;
}

/* —— 分类切换：独立按钮、居中、桌面顶 / 手机底 —— */
.cat-switch {
  z-index: 30;
  margin: 0.35rem 0 1.1rem;
  background: transparent;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  padding: 0;
}

.cat-switch-track {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  width: 100%;
}

.cat-btn {
  flex: 0 1 auto;
  min-width: 4.5rem;
  max-width: 9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 2.5rem;
  padding: 0 1rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.42);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 8px 20px rgba(148, 163, 184, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.65);
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition:
    background 0.28s ease,
    color 0.28s ease,
    border-color 0.28s ease,
    box-shadow 0.28s ease,
    transform 0.28s ease;
}

.cat-btn span {
  display: block;
  width: 100%;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cat-btn:hover {
  background: rgba(255, 255, 255, 0.62);
  color: var(--text);
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(100, 116, 139, 0.18);
}

.cat-btn.is-active {
  background: rgba(20, 184, 166, 0.28);
  border-color: rgba(20, 184, 166, 0.45);
  color: var(--brand-strong);
  box-shadow: 0 10px 22px rgba(20, 184, 166, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

/* 手机：底栏独立按钮 */
@media (max-width: 720px) {
  .shell {
    padding-bottom: calc(4.75rem + env(safe-area-inset-bottom, 0px));
  }

  .cat-switch {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    margin: 0;
    z-index: 40;
    padding: 0.55rem 0.75rem calc(0.55rem + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(180deg, transparent, rgba(240, 253, 250, 0.72) 28%, rgba(236, 254, 255, 0.88));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }

  .cat-switch-track {
    gap: 0.5rem;
    justify-content: center;
  }

  .cat-btn {
    flex: 1 1 0;
    min-width: 0;
    max-width: none;
    height: 2.65rem;
    padding: 0 0.55rem;
    font-size: 0.8rem;
  }
}

@media (min-width: 721px) {
  .cat-switch {
    position: sticky;
    top: 0.75rem;
  }
}

.catalog-panel {
  min-height: 40vh;
}
.catalog-panel.is-switching {
  opacity: 0.35;
  transform: translateY(6px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
}
.catalog-panel.is-ready {
  opacity: 1;
  transform: none;
  animation: catalog-in 0.28s ease;
}

@keyframes catalog-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.section {
  margin: 0 0 1rem;
}
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}

/* 手机 2 列；桌面更密，不再卡在约 5 列 */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

@media (min-width: 640px) {
  .tile-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.9rem;
  }
}

@media (min-width: 900px) {
  .tile-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
  }
}

@media (min-width: 1200px) {
  .shell {
    max-width: 1400px;
  }
  .tile-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
}

.tile {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  transition: all 0.2s ease;
  min-width: 0;
  cursor: pointer;
}
.tile:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-float);
  text-decoration: none;
  color: inherit;
}
.tile-cover {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  display: block;
  background: rgba(255, 255, 255, 0.25);
}
.tile-cover--empty {
  display: grid;
  place-items: center;
  color: var(--text-meta);
  font-size: 0.75rem;
  font-weight: 600;
}
.tile-body {
  padding: 0.7rem 0.75rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  flex: 1;
}
.tile-title {
  margin: 0;
  font-size: clamp(0.85rem, 2.5vw, 1rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tile-summary {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}
.tile-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.25rem;
  gap: 0.35rem;
}
.tile-foot .text-meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.catalog-search-wrap {
  margin: 0.15rem 0 0.85rem;
}
.catalog-search {
  width: 100%;
  background: rgba(255, 255, 255, 0.48);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.detail-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  margin: 0.15rem 0 1rem;
}
.detail-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  color: var(--text);
  min-width: 0;
  padding: 0;
  border: none;
  background: transparent;
  font: inherit;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}
.detail-brand:hover {
  text-decoration: none;
  color: var(--brand-strong);
}
.detail-brand-mark {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 0.7rem;
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 800;
  color: #1e3a8a;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 6px 16px rgba(148, 163, 184, 0.18);
  flex-shrink: 0;
}
.detail-brand-text {
  font-size: 1rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.detail-top-actions {
  flex-shrink: 0;
}
.detail-dl-btn {
  min-width: 9.5rem;
  padding-left: 1.35rem;
  padding-right: 1.35rem;
  justify-content: center;
}

.resource-detail {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1.25rem;
}
.detail-cover-wrap {
  padding: 0.65rem;
  align-self: start;
}
.detail-cover {
  width: 100%;
  border-radius: 0.9rem;
  display: block;
  background: rgba(255, 255, 255, 0.25);
}
.detail-main {
  padding: 1.25rem;
}
.detail-text {
  margin: 0;
  white-space: pre-wrap;
  font: inherit;
  font-size: 0.875rem;
  line-height: 1.65;
  color: #334155;
  padding: 1rem;
}

.comment-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-bottom: 1rem;
}
.comment-item {
  padding: 0.85rem 1rem;
}
.comment-item p {
  margin: 0.35rem 0 0;
  font-size: 0.875rem;
  color: #334155;
}
.comment-form {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.comment-form textarea {
  min-height: 96px;
  resize: vertical;
}

.comment-fab {
  position: fixed;
  right: 1.1rem;
  bottom: calc(1.1rem + env(safe-area-inset-bottom, 0px));
  z-index: 40;
  width: 3.4rem;
  height: 3.4rem;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: #1e40af;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 12px 28px rgba(59, 130, 246, 0.28);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.comment-fab:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 16px 32px rgba(59, 130, 246, 0.34);
}

.store-sheet-root {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 0.85rem;
}
.store-sheet-root[hidden] {
  display: none !important;
}
.store-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.28);
  backdrop-filter: blur(4px);
}
.store-sheet {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  max-height: min(78vh, 560px);
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  animation: store-sheet-in 0.22s ease;
  background: rgba(255, 255, 255, 0.72);
}
@keyframes store-sheet-in {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.store-sheet-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1rem 1.15rem 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.45);
}
.store-sheet-head .text-h2 {
  margin: 0;
  font-size: 1.05rem;
  text-align: center;
}
.store-sheet-body {
  padding: 1rem 1.15rem 1.25rem;
  overflow: auto;
}
.comment-submit-actions {
  display: flex;
  justify-content: stretch;
  margin-top: 0.15rem;
  width: 100%;
}
.comment-submit-actions .btn {
  width: 100%;
  max-width: none;
}
body.sheet-open {
  overflow: hidden;
}

.series-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.6rem;
}
.series-list a,
.series-list .series-item {
  display: block;
  width: 100%;
  padding: 0.9rem 1rem;
  font: inherit;
  font-weight: 600;
  color: var(--text);
  text-align: left;
  border: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: all 0.2s ease;
}
.series-list a:hover,
.series-list .series-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-float);
  text-decoration: none;
}

@media (max-width: 800px) {
  .resource-detail {
    grid-template-columns: 1fr;
  }
  .shell {
    padding: 0.65rem 0.65rem 2rem;
  }
  .detail-dl-btn {
    min-width: 7.5rem;
  }
  .comment-fab {
    bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  }
}
