/* ===== 用户投票页 ===== */
.app-header { max-width: 1120px; margin: 0 auto; padding: 26px 20px 10px; }
.app-header-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.app-title-wrap { display: flex; align-items: center; gap: 12px; min-width: 0; }
.app-moon { font-size: 34px; filter: drop-shadow(0 2px 6px rgba(192,138,45,.35)); }
.app-title { font-size: 25px; letter-spacing: 1.5px; }
.app-subtitle { color: var(--ink-2); font-size: 13.5px; margin-top: 3px; }
.app-user { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.user-chip {
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 14px; font-size: 13.5px; color: var(--ink-2); max-width: 46vw;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-chip b { color: var(--ink); font-weight: 600; }

.rules-line {
  margin: 14px 0 0; padding: 10px 14px; border-radius: var(--radius-s);
  background: rgba(255, 253, 248, 0.75); border: 1px dashed var(--line);
  color: var(--ink-2); font-size: 13.5px; display: flex; flex-wrap: wrap; gap: 6px 14px;
}
.rules-line b { color: var(--gold-deep); font-weight: 650; }

.state-banner { margin: 12px 0 0; border-radius: var(--radius-s); padding: 10px 14px; font-size: 14px; display: none; }
.state-banner.show { display: block; }
.state-banner.warn { background: var(--gold-soft); color: var(--gold-deep); }
.state-banner.muted { background: var(--surface-2); color: var(--ink-2); }

/* ---- 顶部个人已选栏（sticky） ---- */
.pickbar-wrap { position: sticky; top: 0; z-index: 500; padding: 10px 20px 8px; max-width: 1120px; margin: 0 auto; }
.pickbar {
  background: rgba(255, 253, 248, 0.96); backdrop-filter: blur(8px);
  border: 1.5px solid var(--gold-soft); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.pickbar-main {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
}
.pickbar-label {
  font-size: 12.5px; font-weight: 700; color: var(--gold-deep);
  writing-mode: initial; flex-shrink: 0; display: flex; align-items: center; gap: 5px;
}
.pickbar-counts { display: flex; gap: 8px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.pickbar-counts::-webkit-scrollbar { display: none; }
.count-chip {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px;
  border-radius: 10px; padding: 5px 10px; min-width: 86px; flex-shrink: 0;
  border: 1.5px solid transparent;
}
.count-chip .cc-top { font-size: 12px; font-weight: 650; display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.count-chip .cc-nums { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.count-chip.full { border-color: currentColor; }
.count-chip.lv1 { background: var(--lv1-soft); color: var(--lv1-deep); }
.count-chip.lv2 { background: var(--lv2-soft); color: var(--lv2-deep); }
.count-chip.lv3 { background: var(--lv3-soft); color: var(--lv3-deep); }
.cc-bar { width: 100%; height: 4px; border-radius: 2px; background: rgba(0,0,0,0.08); overflow: hidden; }
.cc-bar i { display: block; height: 100%; border-radius: 2px; background: currentColor; transition: width .25s ease; }

.pickbar-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; margin-left: auto; }
.pickbar-submit-area { display: flex; align-items: center; gap: 8px; }
.pickbar-submit-hint { font-size: 12px; color: var(--ink-3); max-width: 130px; line-height: 1.35; text-align: right; }

.expand-btn {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  border-radius: 999px; padding: 7px 13px; font-size: 13px; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px; min-height: 36px;
}
.expand-btn .arrow { transition: transform .2s; font-size: 11px; }
.expand-btn.open .arrow { transform: rotate(180deg); }

.pickbar-detail { display: none; border-top: 1px dashed var(--line); padding: 10px 12px 12px; max-height: 46vh; overflow-y: auto; }
.pickbar-detail.open { display: block; }
.pd-group { margin-bottom: 12px; }
.pd-group:last-child { margin-bottom: 0; }
.pd-group-title { font-size: 12.5px; font-weight: 700; margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.pd-group-title.lv1 { color: var(--lv1-deep); }
.pd-group-title.lv2 { color: var(--lv2-deep); }
.pd-group-title.lv3 { color: var(--lv3-deep); }
.pd-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.pd-cell {
  position: relative; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); padding: 5px; cursor: pointer;
  transition: border-color .12s, box-shadow .12s;
}
.pd-cell:hover { border-color: var(--ink-3); }
.pd-thumb-wrap { position: relative; display: block; }
.pd-thumb { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; background: var(--surface-2); display: block; }
.pd-remove {
  position: absolute; top: 9px; right: 9px;
  width: 22px; height: 22px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(37, 31, 20, 0.72); color: #fff; font-size: 11px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.pd-remove:hover { background: var(--danger); }
.pd-cell-name { display: flex; align-items: baseline; gap: 4px; min-width: 0; margin-top: 4px; }
.pd-seq { font-size: 10.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.pd-name { font-size: 11.5px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.pd-cell-empty { cursor: default; border-style: dashed; }
.pd-cell-empty:hover { border-color: var(--line); }
.pd-thumb-empty {
  display: flex; align-items: center; justify-content: center;
  width: 100%; aspect-ratio: 4 / 3; border-radius: 6px;
  background: var(--surface-2); color: var(--ink-3); font-size: 11.5px;
}
.pd-cell-name-empty { justify-content: center; }
.pd-empty { color: var(--ink-3); font-size: 13px; padding: 2px 0 4px; }

/* ---- 作品网格 ---- */
.works-section { max-width: 1120px; margin: 8px auto 0; padding: 0 20px 46px; }
.works-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.work-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column;
  transition: box-shadow .2s ease, transform .12s ease, border-color .2s;
}
.work-card:hover { box-shadow: var(--shadow-lg); }
.work-card.picked { border-color: var(--gold); }

.wc-thumbbtn {
  position: relative; display: block; width: 100%; border: none; padding: 0; cursor: zoom-in;
  background: var(--surface-2); aspect-ratio: 4 / 3; overflow: hidden;
}
.wc-thumb { width: 100%; height: 100%; object-fit: cover; }
.wc-seq {
  position: absolute; top: 8px; left: 8px;
  background: rgba(37, 31, 20, 0.72); color: #f7ecd7;
  font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px;
  font-variant-numeric: tabular-nums; letter-spacing: .5px;
  backdrop-filter: blur(4px);
}
.wc-zoom {
  position: absolute; right: 8px; bottom: 8px;
  background: rgba(37, 31, 20, 0.6); color: #fff; border-radius: 999px;
  font-size: 11.5px; padding: 3px 9px; display: inline-flex; gap: 4px; align-items: center;
  opacity: .92;
}
.wc-body { padding: 11px 13px 13px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.wc-title-row { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.wc-title { font-size: 15px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.wc-state-tag { font-size: 11.5px; font-weight: 700; flex-shrink: 0; }
.wc-state-tag.lv1 { color: var(--lv1); }
.wc-state-tag.lv2 { color: var(--lv2-deep); }
.wc-state-tag.lv3 { color: var(--lv3); }

.level-btns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: auto; }
.lv-btn {
  border: 1.5px solid var(--line); background: var(--surface); cursor: pointer;
  border-radius: 9px; padding: 7px 2px; min-height: 44px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  font-size: 13px; font-weight: 650; color: var(--ink-2);
  transition: border-color .15s, background .15s, color .15s;
}
.lv-btn small { font-size: 10.5px; font-weight: 500; color: var(--ink-3); }
.lv-btn .lv-check { display: none; font-size: 11px; line-height: 1; }
.lv-btn.lv1:hover:not(:disabled), .lv-btn.lv2:hover:not(:disabled), .lv-btn.lv3:hover:not(:disabled) { border-color: var(--ink-3); }
.lv-btn:disabled { opacity: .45; cursor: not-allowed; }

.lv-btn.selected.lv1 { background: var(--lv1); border-color: var(--lv1); color: #fff; }
.lv-btn.selected.lv2 { background: var(--lv2); border-color: var(--lv2); color: #fff; }
.lv-btn.selected.lv3 { background: var(--lv3); border-color: var(--lv3); color: #fff; }
.lv-btn.selected small { color: rgba(255,255,255,0.85); }
.lv-btn.selected .lv-check { display: inline; }
.lv-btn.selected { grid-column: auto; }

/* 选中态按钮占两格以突出？保持等宽，用描边+勾选 */
.lv-btn.selected { box-shadow: inset 0 0 0 1px rgba(255,255,255,.35), 0 3px 10px rgba(0,0,0,.14); }

/* ---- 预览（大图） ---- */
.preview-mask {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(30, 24, 14, 0.72); backdrop-filter: blur(3px);
  display: none; align-items: center; justify-content: center;
  padding: clamp(10px, 2.5vmin, 26px);
}
.preview-mask.open { display: flex; animation: fade-in .18s ease; }
@keyframes fade-in { from { opacity: 0; } }

.preview-dialog {
  background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg);
  width: min(1060px, 100%); height: 100%; min-height: 0; max-height: 100%;
  display: flex; overflow: hidden; position: relative;
}
.pv-media-wrap {
  flex: 1 1 60%; min-width: 0; min-height: 0;
  display: flex; flex-direction: column;
  background: #1f1a12;
}
.pv-media {
  flex: 1; min-height: 0;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; position: relative;
  background: #1f1a12;
}
/* 用同图模糊放大作背景填充，避免生硬的纯黑留边 */
.pv-bg {
  position: absolute; inset: -32px; width: calc(100% + 64px); height: calc(100% + 64px);
  object-fit: cover; filter: blur(26px) brightness(0.55) saturate(1.15);
}
.pv-img { position: relative; max-width: 100%; max-height: 100%; object-fit: contain; cursor: zoom-in; box-shadow: 0 6px 30px rgba(0, 0, 0, 0.35); }
.pv-nav-bar {
  flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 14px; background: var(--surface); border-top: 1px solid var(--line);
}
.pv-nav-btn {
  border: 1.5px solid var(--line); background: var(--surface); color: var(--ink-2);
  border-radius: 999px; padding: 8px 18px; min-height: 40px; font-size: 14px; font-weight: 600;
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  transition: background .15s, opacity .15s, border-color .15s;
}
.pv-nav-btn:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); border-color: var(--ink-3); }
.pv-nav-btn:disabled { opacity: 0.4; cursor: default; }
.pv-count {
  color: var(--ink-2); font-size: 12.5px; font-variant-numeric: tabular-nums;
  background: var(--surface-2); border-radius: 999px; padding: 4px 14px; white-space: nowrap;
}
.pv-side {
  display: flex; flex-direction: column; min-height: 0; min-width: 0;
  flex: 0 0 clamp(300px, 36%, 400px); border-left: 1px solid var(--line);
}
.pv-side-head {
  padding: 18px 20px 12px; border-bottom: 1px solid var(--line);
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
}
.pv-title { font-size: 19px; line-height: 1.3; }
.pv-seq-line { color: var(--ink-3); font-size: 13px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.pv-close {
  border: none; background: var(--surface-2); color: var(--ink-2); cursor: pointer;
  width: 34px; height: 34px; border-radius: 50%; font-size: 15px; flex-shrink: 0;
}
.pv-close:hover { background: var(--line); }
.pv-body { padding: 16px 20px; overflow-y: auto; flex: 1; min-height: 0; }
.pv-msg-label { font-size: 12.5px; font-weight: 700; color: var(--gold-deep); letter-spacing: 2px; margin-bottom: 6px; }
.pv-msg { font-size: 14.5px; color: var(--ink-2); white-space: pre-wrap; word-break: break-word; }
.pv-msg.empty { color: var(--ink-3); font-style: italic; }
.pv-side-foot { border-top: 1px solid var(--line); padding: 13px 20px calc(14px + env(safe-area-inset-bottom)); }
.pv-level-label { font-size: 13px; font-weight: 650; color: var(--ink-2); margin-bottom: 8px; }
.pv-level-btns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.pv-level-btns .lv-btn { min-height: 52px; font-size: 14px; }

/* ---- 手机端重排 ---- */
@media (max-width: 760px) {
  .app-header { padding: 18px 14px 6px; }
  .app-header-top { flex-direction: column; gap: 8px; }
  .app-user { width: 100%; justify-content: space-between; flex-wrap: nowrap; }
  .app-user .badge-deadline { display: none; }
  .user-chip { flex: 1; min-width: 0; text-align: center; }
  .app-user .btn { flex-shrink: 0; }
  .app-title { font-size: 21px; }
  .app-moon { font-size: 28px; }
  .rules-line { font-size: 12.5px; padding: 9px 12px; }

  .pickbar-wrap { padding: 8px 10px 6px; top: 0; }
  .pickbar-main { padding: 8px 10px; gap: 8px; flex-wrap: wrap; }
  .pickbar-label { width: 100%; justify-content: space-between; }
  .pickbar-counts { order: 3; flex: 1 1 100%; }
  .count-chip { flex: 1; min-width: 0; padding: 5px 9px; }
  .count-chip .cc-nums { font-size: 14px; }
  .pickbar-actions { order: 2; margin-left: auto; }
  .pickbar-submit-hint { display: none; }
  .pickbar-detail { max-height: 52dvh; }
  .pd-grid { gap: 6px; }
  .pd-cell { padding: 4px; border-radius: 8px; }
  .pd-name { font-size: 10.5px; }
  .pd-remove { width: 20px; height: 20px; top: 7px; right: 7px; }

  .works-section { padding: 0 12px 120px; }
  .works-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .wc-body { padding: 9px 10px 10px; gap: 8px; }
  .wc-title { font-size: 13.5px; }
  .lv-btn { min-height: 46px; padding: 5px 2px; font-size: 12.5px; border-radius: 8px; }
  .lv-btn small { font-size: 10px; }

  .preview-mask { padding: 0; }
  /* 固定比例：上部 3/5 为图片预览框（含翻页条），中部寄语可滚动，投票固定底部 */
  .preview-dialog {
    width: 100%; height: 100dvh; max-height: none; border-radius: 0;
    flex-direction: column;
  }
  .pv-media-wrap { flex: 0 0 60dvh; min-height: 0; }
  .pv-media { flex: 1; min-height: 0; height: auto; }
  .pv-img { max-height: 100%; width: 100%; }
  .pv-nav-bar { padding: 8px 14px; }
  .pv-nav-btn { min-height: 44px; flex: 1; justify-content: center; }
  .pv-count { flex-shrink: 0; }
  .pv-side { flex: 1 1 auto; min-height: 0; border-left: none; }
  .pv-side-head { padding: 12px 14px 10px; flex-shrink: 0; }
  .pv-title { font-size: 16.5px; }
  .pv-body { padding: 12px 14px; flex: 1; min-height: 0; overflow-y: auto; }
  .pv-side-foot {
    flex-shrink: 0;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
    background: var(--surface); box-shadow: 0 -4px 16px rgba(50,38,16,.08);
  }
  .pv-level-btns .lv-btn { min-height: 50px; }
}

@media (max-width: 360px) {
  .works-grid { grid-template-columns: 1fr; }
}

/* 提交状态条内联提示 */
.submit-state { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ok); font-weight: 650; }

/* 提交状态条内联提示 */
.submit-state { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ok); font-weight: 650; }

/* ---- 全屏大图灯箱（点击图片/任意处关闭，不开新窗口） ---- */
.lb-mask {
  position: fixed; inset: 0; z-index: 1200; /* 高于预览(1000)与替换弹窗(1100) */
  background: rgba(16, 13, 9, 0.96);
  display: flex; align-items: center; justify-content: center;
  cursor: zoom-out; animation: fade-in .15s ease;
}
.lb-mask img {
  max-width: 100vw; max-height: 100dvh; object-fit: contain;
  cursor: zoom-out;
}
.lb-hint {
  position: absolute; bottom: calc(16px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%);
  color: rgba(247, 236, 215, 0.8); font-size: 12.5px; white-space: nowrap;
  background: rgba(37, 31, 20, 0.55); border-radius: 999px; padding: 4px 14px;
  pointer-events: none;
}

/* ---- 名额已满 · 选择替换弹窗 ---- */
.rp-mask {
  position: fixed; inset: 0; z-index: 1100; /* 高于预览(1000)、低于 toast(3000) */
  background: rgba(30, 24, 14, 0.62); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; padding: 18px;
  animation: fade-in .16s ease;
}
.rp-dialog {
  width: min(660px, 100%); max-height: min(88dvh, 780px);
  display: flex; flex-direction: column; padding: 18px 18px 16px;
}
.rp-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.rp-title { font-size: 17px; }
.rp-sub { font-size: 13px; color: var(--ink-2); margin-top: 5px; line-height: 1.5; }
.rp-sub b { color: var(--gold-deep); }

.rp-grid {
  overflow-y: auto; min-height: 0;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px;
  padding: 2px;
}
.rp-cell {
  position: relative; border: 1.5px solid var(--line); border-radius: 12px;
  background: var(--surface); cursor: pointer; padding: 6px;
  display: flex; flex-direction: column; gap: 5px; text-align: left;
  transition: border-color .12s, background .12s, box-shadow .12s;
  font-family: inherit;
}
.rp-cell:hover { border-color: var(--ink-3); }
.rp-cell.selected {
  border-color: var(--gold); background: var(--gold-soft);
  box-shadow: 0 0 0 2px rgba(192, 138, 45, 0.25);
}
.rp-thumb-wrap { position: relative; display: block; }
.rp-thumb { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; background: var(--surface-2); display: block; }
.rp-radio {
  position: absolute; top: 5px; right: 5px;
  width: 20px; height: 20px; border-radius: 50%;
  background: rgba(255, 253, 248, 0.92); border: 1.5px solid var(--line);
  color: transparent; font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.rp-cell.selected .rp-radio { background: var(--gold); border-color: var(--gold); color: #fff; }
.rp-line { display: flex; align-items: baseline; gap: 5px; min-width: 0; }
.rp-seq { font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.rp-name { font-size: 12.5px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.rp-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; flex-shrink: 0; }

@media (max-width: 760px) {
  .rp-mask { padding: 12px; align-items: flex-end; }
  .rp-dialog { max-height: 86dvh; padding: 14px 12px 12px; border-radius: 16px 16px 0 0; }
  .rp-title { font-size: 15.5px; }
  .rp-grid { gap: 8px; }
  .rp-cell { padding: 5px; border-radius: 10px; }
  .rp-name { font-size: 11.5px; }
  .rp-foot { margin-top: 12px; }
  .rp-foot .btn { flex: 1; }
}
