/* ===== OPED 鉴赏页面样式 ===== */

/* 按钮样式 */
.btn-primary, .btn-secondary, .btn-success, .btn-warning, .btn-admin, .btn-small {
  padding: 0.625rem 1.25rem;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: auto;
  position: relative;
  z-index: 1;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-secondary {
  background: var(--card-bg);
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-secondary:hover {
  background: var(--card-hover);
  border-color: var(--primary);
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-success:hover {
  background: #16a34a;
  transform: translateY(-1px);
}

.btn-warning {
  background: var(--warning);
  color: #000;
}

.btn-warning:hover {
  background: #d97706;
  transform: translateY(-1px);
}

.btn-admin {
  background: var(--card-bg);
  border: 1px solid var(--primary);
  color: var(--primary);
}

.btn-admin:hover {
  background: var(--primary);
  color: white;
}

.btn-admin.unlocked {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.btn-small {
  background: var(--card-hover);
  color: var(--text);
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
}

/* 容器 */
.oped-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 1rem;
  min-height: 100vh;
}

/* 头部 */
.oped-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--border);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-left h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0;
}

/* 管理员态：页面大标题可点击改名（.title-editable 由 updatePageTitle() 在有场次时加上） */
#opedPageTitle.title-editable {
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.15s;
}
#opedPageTitle.title-editable:hover {
  background: rgba(99, 102, 241, 0.08);
}

.header-right {
  display: flex;
  gap: 0.75rem;
}

/* 待选项管理区 */
.items-management {
  flex-direction: column;
  margin-bottom: 2rem;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.section-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
}

.items-list {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  min-height: 100px;
}

/* 待选项卡片 */
.item-card {
  width: 120px;
  height: 120px;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  cursor: move;
  transition: all 0.3s ease;
  border: 2px solid var(--border);
  background: var(--bg);
}

.item-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
  border-color: var(--primary);
}

.item-card.dragging {
  opacity: 0.5;
  transform: scale(1.05);
}

/* 可点击评分的待选项卡片：点击打开单项评分弹窗（仍可拖拽排序） */
.item-card.item-card-rateable {
  cursor: pointer;
}

/* 夯拉表卡片左上角分数徽章：结算均分（待选项卡片左上角不再展示人数 X/X） */
.item-card-score-badge {
  position: absolute;
  top: 0.4rem;
  left: 0.4rem;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.4;
  pointer-events: none;
}

.item-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.item-card-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--card-hover), var(--card-bg));
  font-size: 2rem;
}

/* ===== 图片渐进加载：微光骨架 + 加载后淡入 =====
   思路：骨架层 .oped-shimmer 作为卡片第一个子元素（position:absolute、无 z-index），
   位于正常文档流的 <img>（.oped-img-fade）「之下」的绘制层；图片加载前 opacity:0
   （透明，骨架透出来），加载完成 .is-ready 淡入盖住骨架，同时给骨架加 .is-hidden
   停掉动画。name/badge/操作按钮等都是定位元素，本就在 img 之上，无需改 z-index。 */
.oped-shimmer {
  position: absolute;
  inset: 0;
  pointer-events: none;                       /* 不挡卡片点击/拖拽 */
  background: linear-gradient(110deg,
    var(--card-bg) 30%,
    var(--card-hover) 50%,
    var(--card-bg) 70%);
  background-size: 200% 100%;
  animation: oped-shimmer 1.4s linear infinite;
}
.oped-shimmer.is-hidden { display: none; }     /* 图片加载完：停掉并隐藏骨架 */
.oped-shimmer.is-failed { animation: none; }   /* 图片加载失败：停掉动画保留底色，避免无限转圈 */
@keyframes oped-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* 图片本体：初始透明（透出背后骨架），加载完成淡入盖住骨架 */
.oped-img-fade {
  opacity: 0;
  transition: opacity 0.4s ease;
}
.oped-img-fade.is-ready { opacity: 1; }
.oped-img-fade.is-instant { transition: none; }   /* 缓存命中：渲染后即时显示，跳过淡入 */
.oped-img-fade.is-broken { display: none; }

.item-card-name {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  /* 仅底部渐变条，不覆盖整张图，避免把背景图压暗 */
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
  color: white;
  padding: 0.5rem 0.4rem;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.25;
}

/* 两行截断放到内层 span：外层用 flex 居中，若同元素再设 -webkit-line-clamp 会破坏居中 */
.item-card-name span {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.item-card-actions {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  display: flex;
  gap: 0.25rem;
  opacity: 0;
  transition: opacity 0.2s;
}

.item-card:hover .item-card-actions {
  opacity: 1;
}

.item-card-btn {
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  transition: background 0.2s;
}

.item-card-btn:hover {
  background: var(--danger);
}

/* 结算按钮（区别于删除）：绿色，单独 hover；未评分时禁用 */
.item-card-btn.settle {
  background: var(--success);
}

.item-card-btn.settle:hover {
  background: #16a34a;
}

/* 结算 / 清空按钮：该项还没有评分时禁用（灰显、不可点） */
.item-card-btn.settle:disabled,
.item-card-btn.clear:disabled {
  background: rgba(0, 0, 0, 0.4);
  opacity: 0.5;
  cursor: not-allowed;
}

/* 回退按钮（已结算项）：靛蓝色，区别于结算(绿)/删除(红) */
.item-card-btn.revert {
  background: var(--primary);
}

.item-card-btn.revert:hover {
  background: #4f46e5;
}

/* 排行榜行的回退按钮 */
.ranking-revert-btn {
  flex-shrink: 0;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}

/* 夯拉表 */
.tier-table-section {
  margin-bottom: 2rem;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.tier-table {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.tier-row {
  display: flex;
  min-height: 100px;
  border-bottom: 1px solid var(--border);
}

.tier-row:last-child {
  border-bottom: none;
}

.tier-label {
  width: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1rem;
  border-right: 1px solid var(--border);
  flex-shrink: 0;
  position: relative;
}

.tier-label::after {
  content: '';
  position: absolute;
  right: -1px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(0, 0, 0, 0.1);
}

/* 等级颜色 */
.tier-label.tier-1 {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
}

.tier-label.tier-2 {
  background: linear-gradient(135deg, #f97316, #ea580c);
  color: white;
}

.tier-label.tier-3 {
  background: linear-gradient(135deg, #eab308, #ca8a04);
  color: white;
}

.tier-label.tier-4 {
  background: linear-gradient(135deg, #fef08a, #fde047);
  color: #854d0e;
}

.tier-label.tier-5 {
  background: linear-gradient(135deg, #ffffff, #f1f5f9);
  color: #475569;
}

.tier-content {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 1rem;
  align-items: flex-start;
  min-height: 100px;
  position: relative;
}

.tier-content.drag-over {
  background: rgba(99, 102, 241, 0.1);
}

/* 排行榜 */
.rankings-section {
  margin-bottom: 2rem;
}

.rankings-list {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  max-height: 500px;
  overflow-y: auto;
}

.ranking-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  transition: background 0.2s;
}

.ranking-item:last-child {
  border-bottom: none;
}

.ranking-item:hover {
  background: var(--card-hover);
}

.ranking-rank {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1rem;
  border-radius: 50%;
  flex-shrink: 0;
}

.ranking-rank.rank-1 {
  background: linear-gradient(135deg, #ffd700, #ffed4e);
  color: #000;
  box-shadow: 0 2px 8px rgba(255, 215, 0, 0.4);
}

.ranking-rank.rank-2 {
  background: linear-gradient(135deg, #c0c0c0, #e8e8e8);
  color: #000;
}

.ranking-rank.rank-3 {
  background: linear-gradient(135deg, #cd7f32, #e8a868);
  color: #000;
}

.ranking-rank.rank-other {
  background: var(--card-hover);
  color: var(--text-light);
}

.ranking-item-info {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.ranking-item-image {
  position: relative;                          /* 让内部 .oped-shimmer 锚定到这 50×50 框 */
  width: 50px;
  height: 50px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.ranking-item-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ranking-item-name {
  font-weight: 600;
  font-size: 1rem;
}

.ranking-item-tier {
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--card-hover);
  color: var(--text-light);
}

.ranking-item-score {
  font-size: 1.25rem;
  font-weight: bold;
  color: var(--success);
  flex-shrink: 0;
}

/* 等级配置 */
.tier-config-list {
  margin-bottom: 1rem;
}

.tier-config-item {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding: 0.75rem;
  background: var(--bg);
  border-radius: 8px;
  margin-bottom: 0.5rem;
}

.tier-config-item input {
  flex: 1;
}

.tier-config-item input[type="color"] {
  width: 50px;
  flex: none;
}

.tier-config-item .btn-icon {
  background: var(--danger);
  color: white;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 4px;
  cursor: pointer;
}

/* 单项评分：纵向人员行（点击待选项卡片打开弹窗，每次只评一个待选项） */
.rating-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

/* 评分弹窗工具栏：放置「随机排序」等小工具按钮，默认右对齐 */
.rating-grid-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.5rem;
}

/* 弹窗顶部预览当前待选项 */
.rating-item-preview {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
}

.rating-item-preview img {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: 12px;
}

.rating-item-preview .item-card-placeholder {
  width: 100px;
  height: 100px;
  border-radius: 12px;
}

/* 一行 = 一个人员 + 其分数输入框 */
.rating-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: var(--card-hover);
  border-radius: 8px;
}

.rating-row-player {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  min-width: 0;
}

.rating-row-player span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rating-row .rating-input {
  width: 90px;
  flex: none;
}

/* 已移出本场但留有评分的人员行：只读 + 删除按钮 */
.rating-row-removed {
  background: rgba(148, 163, 184, 0.18);
}

.rating-row-tag {
  font-size: 0.7rem;
  font-style: normal;
  font-weight: 600;
  color: #64748b;
  background: #e2e8f0;
  border-radius: 999px;
  padding: 0.05rem 0.4rem;
  flex: none;
}

.rating-row-score {
  width: 90px;
  flex: none;
  text-align: center;
  font-size: 1rem;
  font-weight: 600;
  color: var(--success);
}

.rating-row-del {
  width: 28px;
  height: 28px;
  flex: none;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--danger, #ef4444);
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.rating-row-del:hover {
  background: rgba(239, 68, 68, 0.12);
}

.rating-input {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
  text-align: center;
  font-size: 1rem;
}

.rating-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

/* 图片预览 */
.image-preview {
  margin-bottom: 1rem;
}

.image-preview .preview-placeholder {
  width: 120px;
  height: 120px;
  border: 2px dashed var(--border);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  font-size: 3rem;
}

.image-preview img {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 12px;
}

/* 空状态 */
.empty-state {
  text-align: center;
  color: var(--text-light);
  padding: 2rem;
  grid-column: 1 / -1;
}

/* 确保隐藏的模态框不会阻止点击 */
.modal[style*="display: none"],
.modal[style*="display:none"] {
  pointer-events: none;
  visibility: hidden;
}

/* 确保按钮在所有情况下都可点击 */
button, .btn-primary, .btn-secondary, .btn-success, .btn-warning, .btn-admin, .btn-small {
  pointer-events: auto !important;
}

/* 人员视角特殊样式 */
.oped-view .oped-container {
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  min-height: 100vh;
}

body.oped-view {
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  color: #1e293b;
}

.oped-view .oped-header {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.oped-view .tier-table {
  background: white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.oped-view .tier-row {
  border-bottom-color: #e2e8f0;
}

.oped-view .tier-label {
  border-right-color: #e2e8f0;
}

.oped-view .rankings-list {
  background: white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.oped-view .ranking-item {
  border-bottom-color: #e2e8f0;
}

.oped-view .ranking-item:hover {
  background: #f8fafc;
}

/* 待选项列表 / 参与人员列表：浅色主题下与其它卡片保持一致
   （默认 --card-bg 是深色 #1e293b，没覆盖的话在浅色页面里会显得突兀） */
.oped-view .items-list,
.oped-view .session-players-chips {
  background: white;
  border-color: #e2e8f0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* 人员 chip 调浅，避免深底配深色文字看不清 */
.oped-view .session-player-chip {
  background: #f1f5f9;
  border-color: #e2e8f0;
  color: #1e293b;
}

.oped-view .session-player-avatar,
.oped-view .session-player-emoji {
  background: #e2e8f0;
}

/* OPED 浅色主题下的次要按钮：默认 btn-secondary / btn-admin / btn-small
   用了深色 --card-bg / --card-hover 作底，在浅色页面里会显得突兀，统一改成浅色描边 */
.oped-view .btn-secondary {
  background: white;
  border-color: #cbd5e1;
  color: #1e293b;
}

.oped-view .btn-secondary:hover {
  background: #f1f5f9;
  border-color: var(--primary);
}

.oped-view .btn-admin {
  background: white;
  color: var(--primary);
  border-color: var(--primary);
}

.oped-view .btn-admin:hover {
  background: var(--primary);
  color: white;
}

.oped-view .btn-small {
  background: #f1f5f9;
  color: #1e293b;
  border: 1px solid #e2e8f0;
}

/* admin-only 区块在 oped 页用 block 布局（覆盖 style.css 全局的 flex，section 需上下排列） */
body.is-admin .oped-view .admin-only {
  display: block !important;
}

/* 响应式 */
@media (max-width: 768px) {
  .oped-header {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }

  .header-right {
    flex-wrap: wrap;
  }

  .tier-label {
    width: 80px;
    font-size: 0.875rem;
  }

  .item-card {
    width: 100px;
    height: 100px;
  }

  .item-card-name {
    font-size: 0.85rem;
  }
}

/* ===== 参与人员管理 ===== */
.players-management {
  flex-direction: column;
  margin-bottom: 2rem;
}

.players-management .section-header {
  margin-bottom: 1rem;
}

.session-players-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 1rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  min-height: 60px;
  align-items: center;
}

/* 空状态在 chips 容器内收窄内边距，避免为空时整体比有人员时明显偏高 */
.session-players-chips .empty-state {
  padding: 0.25rem 0;
  width: 100%;
}

.session-player-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.85rem;
  background: var(--card-hover);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 500;
}

.session-player-avatar,
.session-player-emoji {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-size: 1rem;
  background: var(--bg);
  flex-shrink: 0;
}

.session-player-avatar {
  object-fit: cover;
}

/* 勾选弹窗里的人员行 */
.session-player-row {
  cursor: default;
}

.session-player-row.joined {
  background: rgba(99, 102, 241, 0.08);
}

.session-player-row .list-item-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* ===== 待选项管理页（/oped/items）===== */
/* 本页为浅色主题（body.oped-view），卡片统一白底 + 浅边框 + 柔和阴影，
   与主页 /oped 的夯拉表 / 排行榜视觉保持一致，避免深色 --card-bg 在浅色页里突兀。 */

/* 头部副标题 */
.header-titles {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.oped-view .header-titles h1 {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
  color: #1e293b;
}

.header-subtitle {
  margin: 0;
  font-size: 0.875rem;
  color: #64748b;
}

/* 头部统计徽章 */
.stat-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4rem;
  padding: 0.5rem 1.1rem;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(139, 92, 246, 0.12));
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: 999px;
}

.stat-num {
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1;
  color: var(--primary);
}

.stat-label {
  font-size: 0.85rem;
  color: #475569;
}

/* 当前场次信息条 */
.session-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.75rem 1.25rem;
  margin-bottom: 1.5rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-left: 4px solid var(--primary);
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  font-size: 0.95rem;
}

.session-bar-icon {
  font-size: 1.1rem;
}

.session-bar-label {
  color: #64748b;
}

.session-bar-name {
  font-weight: 600;
  color: #1e293b;
}

/* 添加区：浅色卡片 */
.add-item-section {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(99, 102, 241, 0.05);
}

.add-item-section .section-header h2 {
  color: #1e293b;
}

/* 添加表单：左右两栏（左=名称+上传，右=预览+提交） */
.add-item-form {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  align-items: stretch;
}

.add-form-fields {
  flex: 1;
  min-width: 240px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  justify-content: center;
}

.add-form-fields .form-input {
  margin-bottom: 0;
}

.add-form-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  min-width: 160px;
}

.add-form-preview .image-preview {
  margin-bottom: 0;
}

.add-submit-btn {
  width: 100%;
}

.form-tip {
  margin-top: 1rem;
  margin-bottom: 0;
  padding: 0.65rem 0.9rem;
  background: #f1f5f9;
  border-radius: 8px;
  color: #475569;
  font-size: 0.85rem;
}

/* 列表区标题行：标题 + 右侧拖拽提示 */
.items-management .section-header {
  flex-wrap: wrap;
  gap: 0.5rem;
}

.items-management .section-header h2 {
  color: #1e293b;
}

.section-hint {
  font-size: 0.85rem;
  font-weight: 400;
  color: #64748b;
}

/* 拖拽占位符在浅色主题下用浅灰字 */
.oped-view .item-card-placeholder {
  color: #94a3b8;
}

/* 页脚 */
.oped-items-footer {
  text-align: center;
  color: #94a3b8;
  font-size: 0.85rem;
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid #e2e8f0;
}

/* 编辑弹窗内的输入与按钮纵向排列，留出间距 */
#editItemModal .modal-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: stretch;
}

#editItemModal .form-input {
  margin-bottom: 0;
}

/* 窄屏：预览栏横向铺满 */
@media (max-width: 600px) {
  .add-form-preview {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
  }

  .add-submit-btn {
    width: auto;
  }
}

/* ===== 弹窗：浅色主题覆盖 =====
   oped-view 页面为浅色主题，但全局 .modal-content / .modal-header 用的是深色
   --card-bg / --card-hover，录入评分等弹窗会显示成暗色。这里统一改成浅色，
   覆盖录入评分、管理参与人员、管理员登录、编辑待选项等所有弹窗。 */

/* 遮罩：浅色页面下用更柔和的半透明深色 */
.oped-view .modal {
  background: rgba(15, 23, 42, 0.5);
}

/* 弹窗主体：白底 + 浅边框 + 柔和阴影 */
.oped-view .modal-content {
  background: #fff;
  border-color: #e2e8f0;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.oped-view .modal-header {
  background: #f8fafc;
  border-bottom-color: #e2e8f0;
}

.oped-view .modal-header h2 {
  color: #1e293b;
}

.oped-view .close-btn {
  color: #64748b;
}

/* 表单输入框 / 评分输入框：白底深字，避免深色 --bg/--text 突兀
   （不限定 .modal，覆盖 /oped/items 添加区等页面级 form-input） */
.oped-view .form-input,
.oped-view .rating-input {
  background: #fff;
  border-color: #cbd5e1;
  color: #1e293b;
}

.oped-view .form-input::placeholder,
.oped-view .rating-input::placeholder {
  color: #94a3b8;
}

/* 评分行：浅灰底，人员名深色 */
.oped-view .rating-row {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
}

.oped-view .rating-row-player {
  color: #1e293b;
}

/* 参与人员管理弹窗：未加入的人员行默认继承深色 --bg，这里改成浅灰底；
   已加入行用淡紫以示区分（覆盖 912 行 .session-player-row.joined 也统一描边） */
.oped-view .session-player-row {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.oped-view .session-player-row:hover {
  background: #f1f5f9;
}

.oped-view .session-player-row.joined {
  background: rgba(99, 102, 241, 0.1);
  border-color: rgba(99, 102, 241, 0.3);
}

/* 等级设置弹窗：每档配置行默认用深色 --bg，这里改成浅灰底 */
.oped-view .tier-config-item {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

/* ===== 番剧封面搜索（待选项管理页）===== */

/* 上传按钮组：「选择图片」+「番剧封面」并排 */
.upload-btn-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* 搜索弹窗主体收窄 */
.bangumi-modal-content {
  max-width: 560px;
  width: 90%;
}

#bangumiSearchModal .modal-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* 搜索栏：输入框 + 搜索按钮一行 */
.bangumi-search-bar {
  display: flex;
  gap: 0.5rem;
}

.bangumi-search-bar .form-input {
  flex: 1;
  margin-bottom: 0;
}

/* 候选网格 */
.bangumi-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 0.75rem;
  max-height: 360px;
  overflow-y: auto;
  padding: 0.25rem;
}

.bangumi-hint {
  grid-column: 1 / -1;
  text-align: center;
  color: #64748b;
  font-size: 0.9rem;
  padding: 1.5rem 0.5rem;
  line-height: 1.6;
}

/* 单个候选卡片：竖向封面 + 标题，hover 上浮高亮 */
.bangumi-result-item {
  cursor: pointer;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
  background: #f8fafc;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
  display: flex;
  flex-direction: column;
}

.bangumi-result-item:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(99, 102, 241, 0.18);
}

/* 封面区：统一 3/4 竖向比例展示，无封面时给占位 */
.bangumi-result-item img,
.bangumi-no-cover {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  background: #eef2f7;
}

.bangumi-result-name {
  padding: 0.35rem 0.4rem;
  font-size: 0.78rem;
  line-height: 1.3;
  color: #1e293b;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

/* ===== 历史场次页（/oped/history）=====
   双栏布局 + 场次列表卡片 + 详情头部。复用现有 .tier-table / .ranking-item 等
   卡片样式，此处只补布局与列表特有的规则。浅色主题，与 .oped-view 其余区块一致。 */

.history-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1.5rem;
  align-items: flex-start;
}

/* 左侧场次列表侧栏：场次多时自身可滚动 */
.history-sidebar {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
}

.history-sidebar-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.75rem 0;
  color: #1e293b;
}

.history-session-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.history-session-list .empty-state {
  padding: 1.5rem 0.5rem;
  text-align: center;
}

/* 单条场次卡片 */
.history-session-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.history-session-card:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.history-session-card.is-selected {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.06);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

/* 卡片头部：场次名 + 「当前」徽章 同行 */
.history-session-card-head {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.history-session-card-name {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  font-size: 0.95rem;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-session-card-meta {
  margin-top: 0.3rem;
  font-size: 0.8rem;
  color: #64748b;
  display: flex;
  flex-wrap: wrap;
}

/* 场次卡片删除按钮（仅管理员登录后由 JS 渲染）：默认低调，hover 泛红 */
.history-session-delete {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  border-radius: 6px;
  font-size: 0.95rem;
  line-height: 1;
  transition: background 0.15s, color 0.15s;
}

.history-session-delete:hover {
  background: #fee2e2;
  color: #ef4444;
}

/* 场次卡片改名按钮（仅管理员登录后由 JS 渲染）：复用删除按钮尺寸，hover 泛蓝 */
.history-session-rename {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  border-radius: 6px;
  font-size: 0.85rem;
  line-height: 1;
  transition: background 0.15s, color 0.15s;
}

.history-session-rename:hover {
  background: #e0e7ff;
  color: #4f46e5;
}

/* 场次卡片恢复按钮（仅管理员、且非当前场次时由 JS 渲染）：复用改名按钮尺寸，hover 泛绿 */
.history-session-restore {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  border-radius: 6px;
  font-size: 0.9rem;
  line-height: 1;
  transition: background 0.15s, color 0.15s;
}

.history-session-restore:hover {
  background: #dcfce7;
  color: #16a34a;
}

/* 「当前场次」徽章：内联小药丸（侧栏卡片与详情头部共用） */
.history-session-badge.is-current {
  flex-shrink: 0;
  background: rgba(99, 102, 241, 0.15);
  color: var(--primary);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  line-height: 1.5;
}

/* 右侧详情主区：min-width:0 防止 tier-table 撑爆 grid 列 */
.history-main {
  min-width: 0;
}

/* 详情头部：场次名 + 元信息（当前徽章 / 已结算项数 / 创建时间） */
.history-detail-header {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-left: 4px solid var(--primary);
  border-radius: 10px;
  padding: 0.9rem 1.1rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.history-detail-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #1e293b;
  word-break: break-word;
}

.history-detail-meta {
  margin-top: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: #64748b;
}

/* 详情头部的「已结算 N 项」药丸 */
.history-detail-header .history-session-badge.rated-count {
  background: #f1f5f9;
  color: #475569;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
}

.history-detail-date {
  color: #94a3b8;
}

/* 移动端：双栏堆叠为单列，侧栏取消 sticky */
@media (max-width: 768px) {
  .history-layout {
    grid-template-columns: 1fr;
  }

  .history-sidebar {
    position: static;
    max-height: none;
  }
}

/* ===== 右侧「人员评分查看器」（竖版下拉，所有人可见）=====
   选一位人员后，所有已结算的待选项卡片中间会叠加显示该人员对各项的打分。
   固定在页面右侧，宽度略大于头像尺寸；空白处不拦截下方内容的点击。 */
.player-score-viewer {
  position: fixed;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 58px;                 /* 略大于头像尺寸（触发器头像 38px） */
  z-index: 500;                /* 高于页面内容，低于弹窗(1000) */
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.4rem;
  pointer-events: none;        /* 仅触发器/菜单本身可交互 */
}

.psv-trigger {
  width: 58px;
  height: 58px;
  flex: none;
  border: 2px solid #cbd5e1;
  border-radius: 16px;
  background: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
  pointer-events: auto;
}

.psv-trigger:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
}

.player-score-viewer.open .psv-trigger {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

/* 触发器内的头像放大一点，便于辨识 */
.psv-trigger .session-player-avatar,
.psv-trigger .session-player-emoji {
  width: 38px;
  height: 38px;
  font-size: 1.5rem;
}

/* 下拉菜单：纵向排列的头像列表 */
.psv-menu {
  display: none;
  flex-direction: column;
  align-items: stretch;
  gap: 0.25rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 0.4rem;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
  max-height: 60vh;
  overflow-y: auto;
  pointer-events: auto;
}

.player-score-viewer.open .psv-menu {
  display: flex;
}

/* 单个人员选项：竖向 头像 + 名字（截断） */
.psv-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.3rem 0.2rem;
  border: none;
  background: transparent;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s;
  min-width: 0;
}

.psv-option:hover {
  background: #f1f5f9;
}

.psv-option.active {
  background: rgba(99, 102, 241, 0.12);
  box-shadow: inset 0 0 0 2px var(--primary);
}

.psv-option .session-player-avatar,
.psv-option .session-player-emoji {
  width: 32px;
  height: 32px;
  font-size: 1.2rem;
}

.psv-option-name {
  font-size: 0.66rem;
  color: #475569;
  text-align: center;
  line-height: 1.1;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.psv-empty {
  font-size: 0.7rem;
  color: #94a3b8;
  text-align: center;
  padding: 0.5rem 0.2rem;
}

/* 已结算卡片中间的评分叠加层：
   仅在选中人员且该人员评过此项时显示；无评分则留空（不渲染内容） */
.item-card-score-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  min-width: 38px;
  height: 38px;
  padding: 0 0.45rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.82);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 700;
  display: none;                /* 默认隐藏，由 .has-score 控制显隐 */
  align-items: center;
  justify-content: center;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  z-index: 2;                   /* 高于图片，低于 hover 操作按钮 */
  backdrop-filter: blur(2px);
}

.item-card-score-overlay.has-score {
  display: flex;
}

/* 移动端：查看器收窄，避免过多遮挡右侧内容 */
@media (max-width: 768px) {
  .player-score-viewer {
    width: 48px;
    right: 0.5rem;
  }

  .psv-trigger {
    width: 48px;
    height: 48px;
  }

  .psv-trigger .session-player-avatar,
  .psv-trigger .session-player-emoji {
    width: 30px;
    height: 30px;
    font-size: 1.2rem;
  }
}

/* ===== 导出长图 · 预览弹窗 =====
   由 public/js/oped-export.js 在生成完 PNG 后动态创建：先展示预览图，
   用户点「下载图片」再真正生成文件。颜色用具体值而非 CSS 变量，避免解析差异。 */
.oped-export-preview {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  z-index: 2000;                /* 高于普通弹窗(1000) */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  box-sizing: border-box;
}

.oped-export-preview-box {
  position: relative;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  max-width: 720px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.oped-export-preview-close {
  position: absolute;
  top: 0.5rem;
  right: 0.6rem;
  z-index: 2;
  border: none;
  background: rgba(255, 255, 255, 0.85);
  color: #475569;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  transition: background 0.15s, color 0.15s;
}

.oped-export-preview-close:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.oped-export-preview-img-wrap {
  overflow-y: auto;             /* 长图很高时仅图片区滚动 */
  padding: 1rem;
  display: flex;
  justify-content: center;
  align-items: flex-start;      /* 不用默认 stretch：避免 <img> 被拉伸/压扁变形 */
  background: #f8fafc;
  flex: 1 1 auto;               /* 占满弹窗剩余高度 */
  min-height: 0;                /* 关键：允许在 flex column 父级内收缩，长图时滚动条才生效 */
}

.oped-export-preview-img {
  display: block;
  max-width: 100%;
  height: auto;
  flex-shrink: 0;               /* 防止宽度被 flex 压缩，配合 height:auto 保持原比例 */
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.oped-export-preview-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  padding: 0.9rem 1rem;
  border-top: 1px solid #e2e8f0;
  background: #fff;
}

.oped-export-preview-cancel,
.oped-export-preview-download {
  border: none;
  border-radius: 10px;
  padding: 0.55rem 1.4rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
}

.oped-export-preview-cancel {
  background: #e2e8f0;
  color: #475569;
}

.oped-export-preview-cancel:hover {
  background: #cbd5e1;
}

.oped-export-preview-download {
  background: #6366f1;
  color: #fff;
}

.oped-export-preview-download:hover {
  background: #4f46e5;
  transform: translateY(-1px);
}

@media (max-width: 768px) {
  .oped-export-preview {
    padding: 0.75rem;
  }

  .oped-export-preview-box {
    max-width: 100%;
    max-height: 94vh;
  }
}

/* ===== 导出长图（.oped-export-root 离屏容器）=====
   由 public/js/oped-export.js 动态创建，用于把夯拉表 + 排行榜渲染成一张 PNG 长图。
   - 离屏定位（left:-100000px）保持可见尺寸以供 html-to-image 渲染，但用户看不到；
   - 固定 900px 宽度，保证长图各部分对齐、卡片排列规整；
   - 浅色白底，贴合 body.oped-view 的页面观感；
   - 颜色全部用具体值而非 CSS 变量，避免截图库对 var() 的解析差异。
   同时覆盖页面样式：解除排行榜 max-height 截断、去掉卡片动画/光标、兜底隐藏管理元素。 */
.oped-export-root {
  position: fixed;
  left: -100000px;
  top: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 1;            /* 离屏元素也必须可见（非 display:none）才能被渲染 */
}

.oped-export {
  width: 900px;
  padding: 2rem 2.25rem;
  background: #f8fafc;
  color: #1e293b;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  box-sizing: border-box;
}

.oped-export-head {
  padding-bottom: 1rem;
  margin-bottom: 1.25rem;
  border-bottom: 2px solid #e2e8f0;
}

.oped-export-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.3;
  word-break: break-word;
}

.oped-export-sub {
  margin-top: 0.35rem;
  font-size: 0.85rem;
  color: #64748b;
}

.oped-export-section-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: #1e293b;
  margin: 1.5rem 0 0.85rem;
}

/* 夯拉表 / 排行榜克隆进导出容器后复用现有卡片样式，这里只做导出场景必要覆盖 */
.oped-export .tier-table {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.oped-export .tier-row {
  border-bottom: 1px solid #e2e8f0;
}

.oped-export .tier-row:last-child {
  border-bottom: none;
}

.oped-export .tier-label {
  border-right: 1px solid #e2e8f0;
}

/* 关键：解除排行榜的 max-height:500px 截断，完整展开 */
.oped-export .rankings-list {
  max-height: none;
  overflow: visible;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.oped-export .ranking-item {
  border-bottom: 1px solid #e2e8f0;
}

.oped-export .ranking-item:last-child {
  border-bottom: none;
}

/* 去掉卡片动画 / 拖拽光标 / hover 上浮，导出静态版 */
.oped-export .item-card {
  animation: none !important;
  cursor: default !important;
  border-color: #e2e8f0;
}

/* 兜底隐藏管理元素与「谁的分」叠加层（JS 克隆时已移除，这里双保险）。
   注：夯拉表卡片左上角的 .item-card-score-badge（结算均分）不在此列——导出长图需保留分数展示 */
.oped-export .item-card-actions,
.oped-export .ranking-revert-btn,
.oped-export .item-card-score-overlay {
  display: none !important;
}

/* ===== 右侧查看器内的「导出长图」按钮 =====
   与 .psv-trigger 同款圆角方块，但独立一项（不受 .player-score-viewer.open 的触发器高亮影响） */
.psv-export-btn {
  width: 58px;
  height: 58px;
  flex: none;
  border: 2px solid #cbd5e1;
  border-radius: 16px;
  background: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
  pointer-events: auto;
}

.psv-export-btn:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
}

.psv-export-btn .session-player-emoji {
  width: 38px;
  height: 38px;
  font-size: 1.5rem;
}

/* 生成中态：置灰 + 进度光标（由 oped-export.js 在导出期间设置 disabled） */
.psv-export-btn:disabled {
  opacity: 0.6;
  cursor: progress;
}

/* 移动端：与 .psv-trigger 一并收窄 */
@media (max-width: 768px) {
  .psv-export-btn {
    width: 48px;
    height: 48px;
  }

  .psv-export-btn .session-player-emoji {
    width: 30px;
    height: 30px;
    font-size: 1.2rem;
  }
}
