/* 团队共享库（测试）
   冷灰纸底 + 深靛蓝墨色；星标用玩具黄；唯一醒目的元素是页头下的黄黑警示胶带，提醒这里是匿名公开的测试区。
   缩略图做成 3:4 的深色屏幕框，对应设备演出时的 3:4 画面窗口。 */

:root {
  --paper: #f2f4fa;
  --panel: #ffffff;
  --ink: #1c2238;
  --muted: #5f6782;
  --line: #d8ddeb;
  --screen: #232a44;
  --hazard: #ffc62b;
  --star: #f0a400;
  --danger: #c3352e;
  --focus: #2f5bea;
  --radius-card: 10px;
  --radius-control: 6px;
  --font: "PingFang SC", "HarmonyOS Sans SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }

html { font-size: 14px; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

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

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

[hidden] { display: none !important; }

/* ---- 页头与警示胶带 ---- */

.masthead { background: var(--panel); border-bottom: 1px solid var(--line); }

.masthead-row {
  display: flex; align-items: baseline; justify-content: space-between;
  max-width: 1480px; margin: 0 auto; padding: 18px 24px 12px;
}

.brand { margin: 0; font-size: 1.5rem; font-weight: 600; letter-spacing: 0.02em; }

.brand-mark { font-weight: 800; letter-spacing: 0.06em; margin-right: 0.35em; }

.tape {
  margin: 0;
  padding: 6px 56px;
  background:
    repeating-linear-gradient(-45deg, var(--ink) 0 10px, var(--hazard) 10px 20px) left / 44px 100% no-repeat,
    repeating-linear-gradient(-45deg, var(--ink) 0 10px, var(--hazard) 10px 20px) right / 44px 100% no-repeat,
    var(--hazard);
  color: var(--ink);
  font-weight: 600;
  text-align: center;
  font-size: 0.93rem;
}

/* ---- 工具栏 ---- */

.toolbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between;
  max-width: 1480px; margin: 0 auto; padding: 14px 24px;
  background: var(--paper);
}

.toolbar-left, .toolbar-right { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.tabs { display: flex; gap: 4px; padding: 3px; background: #e3e7f2; border-radius: 8px; }

.tabs button {
  border: 0; background: transparent; padding: 6px 16px; border-radius: 6px; cursor: pointer;
  color: var(--muted); font-weight: 500;
}

.tabs button[aria-selected="true"] { background: var(--ink); color: #fff; }

.archived-title { margin: 0; font-size: 1.1rem; font-weight: 600; }

.search input {
  width: 220px; padding: 6px 10px 6px 30px;
  border: 1px solid var(--line); border-radius: var(--radius-control); background: var(--panel);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%235f6782' stroke-width='2'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cpath d='m11 11 4 4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 9px center;
}

.tool {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 14px; border: 1px solid var(--line); border-radius: var(--radius-control);
  background: var(--panel); cursor: pointer; white-space: nowrap;
}

.tool:hover:not(:disabled) { border-color: var(--muted); }

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

.tool svg { width: 16px; height: 16px; }

.tool.star[aria-pressed="true"] { background: var(--panel); color: var(--ink); border-color: var(--star); }

.tool.star[aria-pressed="true"] svg { color: var(--star); fill: var(--star); }

.tool:disabled { opacity: 0.45; cursor: not-allowed; }

.tool[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }

.tool-primary { background: var(--ink); color: #fff; border-color: var(--ink); }

.tool-danger { background: var(--danger); color: #fff; border-color: var(--danger); }

.selection-count { color: var(--muted); }

.link-button {
  border: 0; background: none; padding: 4px 0; cursor: pointer;
  color: var(--muted); text-decoration: underline; text-underline-offset: 3px;
}

.link-button[aria-pressed="true"] { color: var(--ink); font-weight: 600; }

/* ---- 卡片网格：每行 5 张（PRD 图稿） ---- */

main { max-width: 1480px; margin: 0 auto; padding: 4px 24px 48px; }

.grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }

@media (max-width: 1280px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 1024px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .grid { grid-template-columns: minmax(0, 1fr); } .search, .search input { width: 100%; } }

.card {
  position: relative;
  display: grid; grid-template-columns: 60px minmax(0, 1fr) auto; gap: 10px; align-items: center;
  padding: 10px; min-height: 100px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-card);
}

.selecting .card { cursor: pointer; }

.card.selected { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }

.card-check { position: absolute; top: 6px; left: 6px; z-index: 1; }

.card-check input { width: 16px; height: 16px; margin: 0; accent-color: var(--ink); }

/* 3:4 屏幕框 */
.thumb {
  position: relative; display: block; width: 60px; aspect-ratio: 3 / 4; padding: 0;
  border: 3px solid var(--screen); border-radius: 7px; background: var(--screen);
  overflow: hidden; cursor: zoom-in;
}

.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.thumb-audio {
  display: grid; place-items: center; cursor: pointer; background: var(--paper);
  border-color: var(--line); color: var(--ink);
}

.thumb-audio svg { width: 26px; height: 26px; }

.thumb-audio.playing { background: var(--ink); border-color: var(--ink); color: #fff; }

.thumb-archived {
  display: grid; place-items: center; cursor: default;
  background: var(--paper); border-color: var(--line); color: var(--muted); font-size: 0.8rem;
}

.upload-form .sheet-foot, .combo-form .sheet-foot { margin: 0 -18px; }

.thumb-badge {
  position: absolute; right: 2px; bottom: 2px; width: 18px; height: 18px;
  display: grid; place-items: center; border-radius: 50%;
  background: rgba(255, 255, 255, 0.72); color: var(--ink);
}

.thumb-badge svg { width: 12px; height: 12px; }

.card-body { min-width: 0; display: flex; flex-direction: column; gap: 2px; }

.card-title {
  font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  border-radius: 4px; cursor: text;
}

.card-title:hover { background: #eef1f8; }

.card-title-input {
  width: 100%; padding: 1px 4px; font-weight: 600;
  border: 1px solid var(--focus); border-radius: 4px;
}

.card-meta, .card-sub { color: var(--muted); font-size: 0.86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.card-actions { display: flex; flex-direction: column; justify-content: space-between; align-self: stretch; }

.icon-button {
  display: grid; place-items: center; width: 30px; height: 30px; padding: 0;
  border: 0; border-radius: 6px; background: transparent; cursor: pointer; color: var(--muted);
}

.icon-button:hover { background: #eef1f8; color: var(--ink); }

.icon-button svg { width: 18px; height: 18px; }

.star[aria-pressed="true"] { color: var(--star); }

.star[aria-pressed="true"] svg { fill: currentColor; }

.restore { font-size: 0.86rem; padding: 4px 8px; }

.empty { margin: 64px auto; max-width: 36em; text-align: center; color: var(--muted); font-size: 1.05rem; }

.list-end { padding: 20px 0; text-align: center; color: var(--muted); font-size: 0.86rem; }

#sentinel { height: 1px; }

/* ---- 提示条 ---- */

.toast-area {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; z-index: 50; width: min(520px, calc(100vw - 32px));
}

.toast {
  padding: 10px 14px; border-radius: 8px; background: var(--ink); color: #fff;
  box-shadow: 0 6px 20px rgba(28, 34, 56, 0.25);
}

.toast.error { background: var(--danger); }

/* ---- 弹层 ---- */

dialog { border: 0; padding: 0; color: var(--ink); }

dialog::backdrop { background: rgba(28, 34, 56, 0.45); }

.sheet {
  width: min(980px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
  border-radius: 12px; background: var(--panel);
}

.sheet-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--panel); z-index: 1;
}

.sheet-title { margin: 0; font-size: 1.2rem; font-weight: 600; overflow-wrap: anywhere; }

.sheet-foot {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  padding: 12px 18px; border-top: 1px solid var(--line);
  position: sticky; bottom: 0; background: var(--panel);
}

.sheet-foot > span { margin-right: auto; color: var(--muted); }

.preview-body { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 20px; padding: 18px; }

@media (max-width: 760px) { .preview-body { grid-template-columns: minmax(0, 1fr); } }

.stage {
  display: grid; place-items: center; min-height: 320px; padding: 12px;
  background: var(--screen); border-radius: 10px; color: #fff; gap: 12px;
}

.stage img, .stage video { max-width: 100%; max-height: 60vh; border-radius: 4px; }

.stage .play-large {
  display: grid; place-items: center; width: 88px; height: 88px; border-radius: 50%;
  border: 0; background: #fff; color: var(--ink); cursor: pointer;
}

.stage .play-large svg { width: 40px; height: 40px; }

.stage-note { font-size: 0.86rem; color: #c7cce0; }

.combo-stage { display: grid; justify-items: center; gap: 14px; }

.preview-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }

.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 14px; margin: 0 0 12px; }

.facts dt { color: var(--muted); }

.facts dd { margin: 0; overflow-wrap: anywhere; }

.facts .unverified { color: var(--muted); font-size: 0.86rem; }

.history summary { cursor: pointer; color: var(--muted); }

.history ol { margin: 8px 0 0; padding-left: 20px; color: var(--muted); font-size: 0.9rem; }

.feedback h3 { font-size: 1rem; margin: 18px 0 8px; }

.feedback-form { display: grid; gap: 6px; }

.feedback-form input, .feedback-form textarea,
.shared-fields input[type="text"], .picker input, .upload-table input {
  width: 100%; padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--radius-control); background: var(--panel);
}

.feedback-form button { justify-self: end; }

.feedback-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 10px; }

.feedback-list li { padding: 8px 10px; background: var(--paper); border-radius: 8px; }

.feedback-list .who { color: var(--muted); font-size: 0.86rem; }

.feedback-list .text { white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---- 上传 ---- */

.upload-form, .combo-form { display: grid; gap: 14px; padding: 18px 18px 0; }

.drop {
  padding: 22px; border: 2px dashed var(--line); border-radius: 10px; text-align: center;
}

.drop.over { border-color: var(--ink); background: #eef1f8; }

.drop p { margin: 0 0 10px; }

.drop-buttons { display: flex; justify-content: center; gap: 10px; margin-bottom: 10px; }

.hint { color: var(--muted); font-size: 0.86rem; }

.upload-table { width: 100%; border-collapse: collapse; }

.upload-table th { text-align: left; color: var(--muted); font-weight: 500; padding: 4px 6px; border-bottom: 1px solid var(--line); }

.upload-table td { padding: 5px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }

.upload-table td:nth-child(2) { color: var(--muted); font-size: 0.86rem; overflow-wrap: anywhere; }

.upload-table td:nth-child(3) { width: 34%; }

.status-ok { color: #1f7a45; }

.status-bad { color: var(--danger); }

.status-warn { color: #8a5a00; }

.status-actions { display: inline-flex; gap: 6px; margin-left: 6px; }

.shared-fields { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: grid; gap: 8px; margin: 0; }

.shared-fields legend { padding: 0 6px; color: var(--muted); }

.shared-fields label { display: grid; gap: 3px; }

.shared-fields .consent { display: flex; gap: 8px; align-items: flex-start; font-weight: 600; }

.shared-fields .consent input { margin-top: 4px; }

/* ---- 组合创建 ---- */

.pickers { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

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

.picker h3 { margin: 0 0 6px; font-size: 1rem; }

.picker-list {
  list-style: none; margin: 8px 0 0; padding: 0; height: 280px; overflow-y: auto;
  border: 1px solid var(--line); border-radius: 8px;
}

.picker-list li { border-bottom: 1px solid var(--line); }

.picker-option {
  display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 10px; align-items: center;
  width: 100%; padding: 6px 8px; border: 0; background: none; text-align: left; cursor: pointer;
}

.picker-option[aria-pressed="true"] { background: var(--ink); color: #fff; }

.picker-option .thumb { width: 44px; cursor: pointer; }

.picker-option .meta { font-size: 0.86rem; opacity: 0.8; }

/* ---- 二次确认 ---- */

.confirm { width: min(420px, calc(100vw - 32px)); border-radius: 12px; padding: 20px; }

.confirm p { margin: 0 0 18px; }

.confirm-buttons { display: flex; justify-content: flex-end; gap: 10px; }

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}
