/* 藏片阁 站点样式。只引用 tokens.css 变量：无裸色值、字号、间距、圆角、阴影。 */

.noscript {
  margin: var(--space-6);
  padding: var(--space-6);
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.icon { display: inline-flex; width: 18px; height: 18px; flex: none; }
.icon svg { width: 100%; height: 100%; }
.mono { font-family: var(--font-mono); }

/* ---- 布局骨架 ---- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  position: sticky;
  top: 0;
  align-self: flex-start;
  display: flex;
  flex-direction: column;
  width: var(--sidebar-width);
  height: 100vh;
  padding: var(--space-5) var(--space-4);
  background: var(--surface);
  border-right: 1px solid var(--border);
  z-index: var(--z-sidebar);
  flex: none;
}
.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3) var(--space-5);
  color: var(--primary-text);
}
.brand .icon { width: 22px; height: 22px; }
.brand-name { font-size: var(--text-lg); font-weight: var(--weight-bold); color: var(--fg); flex: 1; }
.sidebar .drawer-close { display: none; }

.nav { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  height: var(--nav-item-h);
  padding: 0 var(--space-4);
  border-radius: var(--radius);
  color: var(--fg-muted);
  font-size: var(--text-md);
  font-weight: var(--weight-medium);
  text-decoration: none;
  transition: background var(--duration-fast) var(--ease), color var(--duration-fast) var(--ease);
}
.nav-item .icon { width: 20px; height: 20px; }
.nav-item .icon svg { stroke-width: 1.75; }
.nav-item:hover { background: var(--surface-hover); color: var(--fg); }
.nav-item.active { background: var(--primary); color: var(--on-primary); box-shadow: var(--primary-shadow); }

.sidebar-footer { display: flex; flex-direction: column; gap: var(--space-1); padding-top: var(--space-4); border-top: 1px solid var(--border); }
.theme-wrap { position: relative; }
.footer-button {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  height: var(--control-h);
  padding: 0 var(--space-3);
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--fg-muted);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  cursor: pointer;
  text-align: left;
}
.footer-button:hover { background: var(--surface-hover); color: var(--fg); }
.version { padding: var(--space-2) var(--space-3); font-size: var(--text-xs); color: var(--fg-subtle); font-family: var(--font-mono); }

.menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + var(--space-1));
  min-width: 200px;
  padding: 6px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-popover);
  z-index: var(--z-dropdown);
}
.menu-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  height: var(--control-h);
  padding: 0 var(--space-3);
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--fg);
  font: inherit;
  cursor: pointer;
  text-align: left;
}
.menu-item:hover { background: var(--surface-hover); }
.menu-item > span { flex: 1; }
.menu-item .icon:last-child { color: var(--primary-text); }

.menu-button { display: none; }
.overlay { display: none; }

.content { flex: 1; min-width: 0; }
.page { max-width: var(--content-max); margin: 0 auto; padding: var(--space-10) var(--space-12); display: flex; flex-direction: column; gap: var(--space-6); }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--space-6); flex-wrap: wrap; }
.page-title { margin: 0; font-size: var(--text-xl); line-height: var(--leading-xl); font-weight: var(--weight-bold); }
.page-sub { margin: var(--space-1) 0 0; color: var(--fg-muted); font-size: var(--text-sm); }
.back-link { display: inline-flex; align-items: center; gap: var(--space-1); color: var(--fg-muted); font-size: var(--text-sm); text-decoration: none; border-radius: var(--radius-sm); padding: var(--space-1) var(--space-2); margin-left: calc(-1 * var(--space-2)); }
.back-link:hover { background: var(--surface-hover); color: var(--fg); }

/* ---- 卡片 ---- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); padding: var(--space-6); }
.card-title { margin: 0 0 var(--space-4); font-size: var(--text-lg); line-height: var(--leading-lg); font-weight: var(--weight-semibold); }

/* ---- 控件 ---- */
.toolbar { display: flex; gap: var(--space-3); align-items: center; flex-wrap: wrap; }
.search-wrap { position: relative; display: flex; align-items: center; min-width: 260px; flex: 1; }
.search-wrap .icon { position: absolute; left: var(--space-3); color: var(--fg-subtle); pointer-events: none; }
.input {
  height: var(--control-h);
  padding: 0 var(--space-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--fg);
  font: inherit;
  font-size: var(--text-base);
  width: 100%;
}
.search-input { padding-left: calc(var(--space-3) * 2 + 18px); }
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
.select { width: auto; min-width: 180px; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: var(--control-h);
  padding: 0 var(--space-5);
  border: 1px solid transparent;
  border-radius: var(--radius);
  font: inherit;
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  cursor: pointer;
  text-decoration: none;
  transition: background var(--duration-fast) var(--ease), transform var(--duration-fast) var(--ease);
}
.button:disabled { opacity: 0.5; cursor: not-allowed; }
.button.secondary { background: var(--surface); border-color: var(--border-strong); color: var(--fg); }
.button.secondary:hover:not(:disabled) { background: var(--surface-hover); }
.button.soft { background: var(--primary-soft); color: var(--primary-text); }
.button.ghost { background: transparent; color: var(--fg-muted); }
.button.ghost:hover { background: var(--surface-hover); color: var(--fg); }
.button.small { height: var(--control-h-sm); padding: 0 var(--space-3); font-size: var(--text-sm); }
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--control-h);
  height: var(--control-h);
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--fg-muted);
  cursor: pointer;
}
.icon-button:hover { background: var(--surface-hover); color: var(--fg); }

.pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-xs);
  white-space: nowrap;
  text-decoration: none;
}
.pill.primary { background: var(--primary-soft); color: var(--primary-text); }
.pill.success { background: var(--success-soft); color: var(--success); }
.pill.warning { background: var(--warning-soft); color: var(--warning); }
.pill.danger { background: var(--danger-soft); color: var(--danger); }
.pill.neutral { background: var(--neutral-soft); color: var(--fg-muted); }
.pill.link:hover { text-decoration: underline; }

/* ---- 海报墙 ---- */
/* 图集在左、筛选在右；图集用横版官方封面（800×538）。 */
.wall-layout { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: var(--space-6); align-items: start; }
.filters { position: sticky; top: var(--space-6); display: flex; flex-direction: column; gap: var(--space-4); max-height: calc(100vh - var(--space-12)); overflow: auto; padding: var(--space-5); }
.filters-head { display: flex; justify-content: space-between; align-items: center; }
.filters-head .card-title { margin: 0; }
.facet-title { margin: 0 0 var(--space-2); font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--fg-subtle); text-transform: uppercase; letter-spacing: 0.04em; }
.facet-list { display: flex; flex-direction: column; }
.check-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 36px;
  padding: 0 var(--space-2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: var(--text-sm);
  color: var(--fg);
}
.check-row:hover { background: var(--surface-hover); }
.check-row input { accent-color: var(--primary); width: 16px; height: 16px; margin: 0; flex: none; }
.check-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.count { color: var(--fg-subtle); font-size: var(--text-xs); }

.wall-main { display: flex; flex-direction: column; gap: var(--space-6); min-width: 0; }
.wall-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--space-5); }

.work-card { display: flex; flex-direction: column; padding: 0; overflow: hidden; color: inherit; text-decoration: none; transition: box-shadow var(--duration-fast) var(--ease), transform var(--duration-fast) var(--ease); }
.work-card:hover { box-shadow: var(--shadow-card-hover); transform: translateY(-1px); }
.cover-wrap { position: relative; aspect-ratio: 800 / 538; background: var(--neutral-soft); }
.poster, .cover, .sheet { display: block; width: 100%; height: 100%; object-fit: cover; }
.placeholder { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; min-height: 120px; color: var(--fg-subtle); background: var(--neutral-soft); }
.placeholder .icon { width: 32px; height: 32px; }
.cover-badges { position: absolute; left: var(--space-2); top: var(--space-2); display: flex; gap: var(--space-1); flex-wrap: wrap; }
.cover-parts { position: absolute; right: var(--space-2); bottom: var(--space-2); padding: 2px 8px; border-radius: var(--radius-sm); background: var(--surface); color: var(--fg-muted); font-size: var(--text-xs); font-weight: var(--weight-semibold); box-shadow: var(--shadow-card); }
.work-body { display: flex; flex-direction: column; gap: var(--space-1); padding: var(--space-3) var(--space-4) var(--space-4); }
.work-code { font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--primary-text); }
.work-title { font-size: var(--text-base); font-weight: var(--weight-semibold); line-height: var(--leading-base); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: calc(var(--leading-base) * 2); }
.work-meta { font-size: var(--text-sm); color: var(--fg-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.work-foot { display: flex; justify-content: space-between; align-items: center; margin-top: var(--space-1); font-size: var(--text-sm); color: var(--fg-subtle); }

.pager { display: flex; align-items: center; justify-content: center; gap: var(--space-4); }
.pager-text { color: var(--fg-muted); font-size: var(--text-sm); }

/* ---- 状态 ---- */
.state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--space-3); padding: var(--space-12) var(--space-6); }
.state-icon { display: flex; align-items: center; justify-content: center; width: var(--icon-badge); height: var(--icon-badge); border-radius: var(--radius); background: var(--neutral-soft); color: var(--fg-subtle); }
.state-icon .icon { width: 22px; height: 22px; }
.state-icon.danger { background: var(--danger-soft); color: var(--danger); }
.state-title { margin: 0; font-size: var(--text-md); font-weight: var(--weight-semibold); }
.state-body { margin: 0; color: var(--fg-muted); max-width: 420px; }

/* ---- 详情 ---- */
.work-top { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: var(--space-6); align-items: start; }
.cover-card { padding: 0; overflow: hidden; }
.cover-card .cover { aspect-ratio: 800 / 538; object-fit: contain; background: var(--neutral-soft); }
.info { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: var(--space-2) var(--space-4); margin: 0; }
.info dt { color: var(--fg-subtle); font-size: var(--text-sm); }
.info dd { margin: 0; font-size: var(--text-sm); overflow-wrap: anywhere; }
.info a { color: var(--primary-text); text-decoration: none; }
.info a:hover { text-decoration: underline; }
.info-block { margin-top: var(--space-5); }
.chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.chip-link { display: inline-flex; align-items: center; gap: var(--space-2); padding: var(--space-1) var(--space-3) var(--space-1) var(--space-1); border: 1px solid var(--border); border-radius: var(--radius-full); color: var(--fg); font-size: var(--text-sm); text-decoration: none; }
.chip-link:hover { background: var(--surface-hover); }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: var(--radius-full); background: var(--primary-soft); color: var(--primary-text); font-size: var(--text-xs); font-weight: var(--weight-semibold); flex: none; object-fit: cover; }
.avatar.large { width: 40px; height: 40px; border-radius: var(--radius); font-size: var(--text-md); }
.plot { margin: 0; color: var(--fg-muted); font-size: var(--text-sm); white-space: pre-wrap; }

.player { display: flex; flex-direction: column; gap: var(--space-4); }
.video { width: 100%; max-height: 70vh; background: var(--bg); border-radius: var(--radius); }
.hint { margin: 0; color: var(--fg-muted); font-size: var(--text-sm); }
.warning-text { color: var(--warning); }
.path-row { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.path { flex: 1; min-width: 0; padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); background: var(--neutral-soft); color: var(--fg-muted); font-size: var(--text-xs); overflow-wrap: anywhere; user-select: all; }
.segmented { display: inline-flex; gap: var(--space-1); padding: var(--space-1); border-radius: var(--radius); background: var(--neutral-soft); align-self: flex-start; }
.segment { height: var(--control-h-sm); padding: 0 var(--space-4); border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--fg-muted); font: inherit; font-size: var(--text-sm); font-weight: var(--weight-medium); cursor: pointer; }
.segment.on { background: var(--primary); color: var(--on-primary); box-shadow: var(--primary-shadow); }

.sheet-button { display: block; width: 100%; padding: 0; border: 0; border-radius: var(--radius); background: transparent; cursor: zoom-in; overflow: hidden; }
.sheet { height: auto; }

.related .card-title { margin-bottom: var(--space-3); }
.related-row { display: grid; grid-auto-flow: column; grid-auto-columns: 180px; gap: var(--space-4); overflow-x: auto; padding-bottom: var(--space-2); }

.image-overlay { position: fixed; inset: 0; z-index: var(--z-modal); display: flex; align-items: center; justify-content: center; padding: var(--space-6); background: var(--overlay); cursor: zoom-out; }
.image-overlay img { max-width: 100%; max-height: 100%; border-radius: var(--radius); box-shadow: var(--shadow-popover); }
.overlay-close { position: fixed; top: var(--space-4); right: var(--space-4); background: var(--surface); color: var(--fg); }

/* ---- 名册 ---- */
.roster-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--space-3); }
.roster-item { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); color: inherit; text-decoration: none; }
.roster-item:hover { box-shadow: var(--shadow-card-hover); }
.roster-text { min-width: 0; }
.roster-name { font-size: var(--text-md); font-weight: var(--weight-semibold); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.roster-count { font-size: var(--text-sm); color: var(--fg-muted); }

/* ---- 表格 ---- */
.table-wrap { overflow-x: auto; padding: 0; }
.card.table-wrap { padding: 0; }
.table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.table th { text-align: left; padding: var(--space-3) var(--space-4); background: var(--bg); color: var(--fg-muted); font-size: var(--text-sm); font-weight: var(--weight-semibold); white-space: nowrap; }
.table td { padding: var(--space-3) var(--space-4); border-top: 1px solid var(--border); height: 56px; vertical-align: middle; }
.table .num { text-align: right; }
.row-button { cursor: pointer; }
.row-button:hover, .row-button.on { background: var(--surface-hover); }
.path-cell { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--fg-muted); }

/* ---- 统计 ---- */
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-6); }
.stat-card { display: flex; flex-direction: column; gap: var(--space-2); }
.stat-icon { display: flex; align-items: center; justify-content: center; width: var(--icon-badge); height: var(--icon-badge); border-radius: var(--radius); margin-bottom: var(--space-2); }
.stat-icon .icon { width: 22px; height: 22px; }
.stat-icon.blue { background: var(--blue-soft); color: var(--blue); }
.stat-icon.success { background: var(--success-soft); color: var(--success); }
.stat-icon.warning { background: var(--warning-soft); color: var(--warning); }
.stat-icon.primary { background: var(--primary-soft); color: var(--primary-text); }
.stat-label { font-size: var(--text-sm); color: var(--fg-muted); }
.stat-value { font-size: var(--text-display); line-height: var(--leading-display); font-weight: var(--weight-bold); }
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-6); }

/* ---- 手机 ---- */
@media (max-width: 767px) {
  .layout { display: block; }
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform var(--duration) var(--ease); width: min(var(--sidebar-width), 85vw); }
  .drawer-open .sidebar { transform: none; box-shadow: var(--shadow-popover); }
  .sidebar .drawer-close { display: inline-flex; }
  .menu-button { display: inline-flex; position: fixed; top: var(--space-3); left: var(--space-3); z-index: var(--z-sidebar); align-items: center; justify-content: center; width: var(--touch-min); height: var(--touch-min); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--fg); box-shadow: var(--shadow-card); cursor: pointer; }
  .overlay { display: block; position: fixed; inset: 0; background: var(--overlay); z-index: calc(var(--z-sidebar) - 1); }
  .page { padding: calc(var(--space-12) + var(--space-4)) var(--space-4) var(--space-6); gap: var(--space-5); }
  .wall-layout { grid-template-columns: minmax(0, 1fr); }
  .filters { position: static; max-height: none; order: -1; }
  .wall-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: var(--space-3); }
  .work-top { grid-template-columns: minmax(0, 1fr); }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
  .two-col { grid-template-columns: minmax(0, 1fr); }
  .search-wrap { min-width: 0; }
  .input { font-size: 16px; }
  .related-row { grid-auto-columns: 150px; }
}

/* 语言按钮 CH / EN / JP：当前语言高亮 */
.lang-opt { color: var(--fg-muted); }
.lang-opt.on { color: var(--primary); font-weight: var(--weight-semibold); }
.lang-sep { color: var(--fg-muted); }
