/* nano-done-notice-20261003-v1：生成完成醒目提醒。全部选择器以 .tdn- 开头，只额外给出图记录卡片加 .tdn-new-card / .tdn-flash。 */
.tdn-root, .tdn-strip {
  --tdn-bg: #1d1712;
  --tdn-surface: #2a2119;
  --tdn-line: rgba(233, 185, 85, .22);
  --tdn-text: #fff4e4;
  --tdn-sub: #c2ae8f;
  --tdn-accent: #d9a441;
  --tdn-accent-2: #f3cd7a;
  --tdn-accent-ink: #2b1d05;
  --tdn-video: #e0573d;
  --tdn-shadow: 0 24px 60px rgba(0, 0, 0, .55);
  font-family: inherit;
}
.tdn-root.tdn-xcg, .tdn-strip.tdn-xcg {
  --tdn-bg: #f7f7ff;
  --tdn-surface: #ffffff;
  --tdn-line: rgba(80, 82, 180, .16);
  --tdn-text: #1f2140;
  --tdn-sub: #666a8f;
  --tdn-accent: #6f72dc;
  --tdn-accent-2: #8f91e3;
  --tdn-accent-ink: #ffffff;
  --tdn-video: #e4577a;
  --tdn-shadow: 0 24px 60px rgba(30, 30, 90, .28);
}
.tdn-root.tdn-xcg.tdn-night, .tdn-strip.tdn-xcg.tdn-night {
  --tdn-bg: #1b1c2e;
  --tdn-surface: #24263c;
  --tdn-line: rgba(160, 162, 255, .18);
  --tdn-text: #eceeff;
  --tdn-sub: #a2a5cc;
  --tdn-shadow: 0 24px 60px rgba(0, 0, 0, .55);
}

/* 通用按钮 */
.tdn-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 42px; padding: 0 20px; border-radius: 999px; border: 1px solid transparent;
  font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.tdn-btn-sm { min-height: 34px; padding: 0 14px; font-size: 13px; }
.tdn-btn-primary { background: linear-gradient(135deg, var(--tdn-accent-2), var(--tdn-accent)); color: var(--tdn-accent-ink); box-shadow: 0 6px 18px rgba(0,0,0,.14); }
.tdn-btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(0,0,0,.18); }
.tdn-btn-ghost { background: transparent; color: var(--tdn-text); border-color: var(--tdn-line); }
.tdn-btn-ghost:hover { background: rgba(127,127,127,.08); }
.tdn-btn[disabled] { opacity: .4; cursor: default; transform: none; }
.tdn-link { background: none; border: 0; padding: 4px 0; color: var(--tdn-sub); font-size: 12px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.tdn-link:hover { color: var(--tdn-accent); }
.tdn-x {
  position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; border-radius: 50%;
  border: 0; background: rgba(127,127,127,.1); color: var(--tdn-sub); cursor: pointer; display: grid; place-items: center; z-index: 2;
}
.tdn-x svg { width: 18px; height: 18px; }
.tdn-x:hover { color: var(--tdn-text); background: rgba(127,127,127,.18); }
.tdn-x-sm { top: 8px; right: 8px; width: 26px; height: 26px; }
.tdn-x-sm svg { width: 14px; height: 14px; }
.tdn-tag { display: inline-block; padding: 1px 7px; border-radius: 6px; font-size: 11px; font-weight: 700; margin-right: 6px; vertical-align: 1px; }
.tdn-tag-video { background: var(--tdn-video); color: #fff; }
.tdn-tag-image { background: rgba(127,127,127,.16); color: var(--tdn-text); }

/* 缩略图 */
.tdn-thumb, .tdn-toast-thumb, .tdn-chip-thumb { position: relative; display: block; overflow: hidden; background: #2a2a2a; flex: none; }
.tdn-thumb img, .tdn-thumb video, .tdn-toast-thumb img, .tdn-toast-thumb video, .tdn-chip-thumb img, .tdn-chip-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.tdn-thumb-empty { display: block; width: 100%; height: 100%; background: linear-gradient(135deg, #3a3a3a, #222); }
.is-failed img, .is-failed video { filter: grayscale(1) brightness(.7); }
.tdn-play { position: absolute; left: 50%; top: 50%; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; display: grid; place-items: center; backdrop-filter: blur(4px); }
.tdn-play svg { width: 18px; height: 18px; margin-left: 2px; }

/* 居中弹窗 */
.tdn-modal-wrap, .tdn-viewer-wrap { position: fixed; inset: 0; z-index: 2147483000; display: grid; place-items: center; padding: 16px; }
.tdn-modal-wrap[hidden], .tdn-viewer-wrap[hidden] { display: none; }
.tdn-backdrop { position: absolute; inset: 0; background: rgba(15, 12, 8, .5); backdrop-filter: blur(3px); opacity: 0; transition: opacity .2s ease; }
.is-open > .tdn-backdrop { opacity: 1; }
.tdn-modal {
  position: relative; width: min(480px, 100%); max-height: calc(100vh - 32px); overflow: auto;
  background: var(--tdn-bg); color: var(--tdn-text); border-radius: 22px; padding: 26px 24px 20px;
  box-shadow: var(--tdn-shadow); border: 1px solid var(--tdn-line);
  transform: translateY(14px) scale(.97); opacity: 0; transition: transform .24s cubic-bezier(.2,.9,.3,1.2), opacity .2s ease;
}
.is-open > .tdn-modal { transform: none; opacity: 1; }
.tdn-hero { display: flex; gap: 14px; align-items: center; padding-right: 30px; margin-bottom: 18px; }
.tdn-hero-icon {
  width: 52px; height: 52px; border-radius: 16px; flex: none; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--tdn-accent-2), var(--tdn-accent)); color: var(--tdn-accent-ink);
  animation: tdn-ring 1.4s ease .3s 2;
}
.tdn-hero-icon svg { width: 28px; height: 28px; }
@keyframes tdn-ring { 0%,100% { transform: rotate(0); } 15% { transform: rotate(14deg); } 30% { transform: rotate(-12deg); } 45% { transform: rotate(8deg); } 60% { transform: rotate(-5deg); } 75% { transform: rotate(2deg); } }
.tdn-hero h3 { margin: 0 0 4px; font-size: 20px; line-height: 1.3; font-weight: 800; color: var(--tdn-text); }
.tdn-hero p { margin: 0; font-size: 13px; color: var(--tdn-sub); }
.tdn-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.tdn-item {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 14px;
  background: var(--tdn-surface); border: 1px solid var(--tdn-line); color: var(--tdn-text); text-align: left; cursor: pointer;
  transition: border-color .15s ease, transform .15s ease;
}
.tdn-item:hover { border-color: var(--tdn-accent); transform: translateY(-1px); }
.tdn-item .tdn-thumb { width: 92px; height: 66px; border-radius: 10px; }
.tdn-item .tdn-thumb.is-video { width: 118px; height: 72px; }
.tdn-item-copy { min-width: 0; flex: 1; display: grid; gap: 4px; }
.tdn-item-meta { font-size: 12px; color: var(--tdn-sub); }
.tdn-item-prompt { font-size: 13px; line-height: 1.45; color: var(--tdn-text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tdn-item-go { font-size: 24px; color: var(--tdn-sub); padding: 0 4px; }
.tdn-more { margin: 10px 0 0; font-size: 12px; color: var(--tdn-sub); text-align: center; }
.tdn-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.tdn-actions .tdn-btn { flex: 1; }
.tdn-modal > .tdn-link { display: block; margin: 12px auto 0; }

/* 右下角大卡片 */
.tdn-toast-stack { position: fixed; right: 20px; bottom: 20px; z-index: 2147482990; display: grid; gap: 10px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.tdn-toast {
  position: relative; pointer-events: auto; display: flex; gap: 12px; padding: 12px; padding-right: 36px;
  background: var(--tdn-bg); color: var(--tdn-text); border-radius: 18px; border: 1px solid var(--tdn-line); box-shadow: var(--tdn-shadow);
  transform: translateY(20px); opacity: 0; transition: transform .25s cubic-bezier(.2,.9,.3,1.2), opacity .2s ease;
}
.tdn-toast.is-in { transform: none; opacity: 1; }
.tdn-toast.is-strong { border: 1.5px solid var(--tdn-accent); }
.tdn-toast.is-strong::before { content: ""; position: absolute; inset: -1.5px; border-radius: 18px; box-shadow: 0 0 0 0 var(--tdn-accent); animation: tdn-pulse 1.8s ease-out 3; pointer-events: none; }
@keyframes tdn-pulse { 0% { box-shadow: 0 0 0 0 rgba(200,147,47,.55); } 100% { box-shadow: 0 0 0 14px rgba(200,147,47,0); } }
.tdn-xcg .tdn-toast.is-strong::before { animation-name: tdn-pulse-xcg; }
@keyframes tdn-pulse-xcg { 0% { box-shadow: 0 0 0 0 rgba(111,114,220,.55); } 100% { box-shadow: 0 0 0 14px rgba(111,114,220,0); } }
.tdn-toast-thumb { width: 96px; height: 96px; border-radius: 12px; }
.tdn-toast-copy { min-width: 0; display: grid; gap: 4px; align-content: start; }
.tdn-toast-copy b { font-size: 15px; font-weight: 800; }
.tdn-toast-copy > span { font-size: 12.5px; color: var(--tdn-sub); line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tdn-toast-actions { display: flex; gap: 8px; margin-top: 6px; }

/* 顶部悬浮提醒 */
.tdn-pill {
  position: fixed; left: 50%; top: 18px; transform: translateX(-50%); z-index: 2147482980;
  display: inline-flex; align-items: center; gap: 10px; padding: 7px 8px 7px 10px; border-radius: 999px;
  background: var(--tdn-bg); color: var(--tdn-text); border: 1.5px solid var(--tdn-accent); box-shadow: var(--tdn-shadow);
  font-size: 13.5px; font-weight: 600; cursor: pointer; animation: tdn-drop .35s cubic-bezier(.2,.9,.3,1.2);
}
.tdn-pill[hidden] { display: none; }
@keyframes tdn-drop { from { transform: translate(-50%, -16px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
.tdn-pill-icon { position: relative; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, var(--tdn-accent-2), var(--tdn-accent)); color: var(--tdn-accent-ink); }
.tdn-pill-icon svg { width: 16px; height: 16px; }
.tdn-pill-icon i { position: absolute; top: -5px; right: -7px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: #e5383b; color: #fff; font: 700 11px/18px system-ui, sans-serif; font-style: normal; border: 2px solid var(--tdn-bg); }
.tdn-pill b { padding: 5px 12px; border-radius: 999px; background: linear-gradient(135deg, var(--tdn-accent-2), var(--tdn-accent)); color: var(--tdn-accent-ink); font-size: 12.5px; }

/* 出图记录顶部"未查看"置顶条 */
.tdn-strip {
  margin: 0 0 14px; padding: 12px 14px; border-radius: 16px;
  background: var(--tdn-bg); border: 1.5px solid var(--tdn-accent); color: var(--tdn-text);
  box-shadow: 0 6px 20px rgba(0,0,0,.06);
}
.tdn-strip-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.tdn-strip-title { font-size: 14px; font-weight: 700; display: inline-flex; align-items: center; gap: 8px; }
.tdn-strip-title b { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: #e5383b; color: #fff; font-size: 12px; display: inline-grid; place-items: center; }
.tdn-dot { width: 8px; height: 8px; border-radius: 50%; background: #e5383b; box-shadow: 0 0 0 0 rgba(229,56,59,.6); animation: tdn-dot 1.6s ease-out infinite; }
@keyframes tdn-dot { 0% { box-shadow: 0 0 0 0 rgba(229,56,59,.6); } 100% { box-shadow: 0 0 0 8px rgba(229,56,59,0); } }
.tdn-strip-row { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; }
.tdn-chip {
  position: relative; flex: none; width: 150px; padding: 0; border-radius: 12px; overflow: hidden; cursor: pointer;
  background: var(--tdn-surface); border: 1px solid var(--tdn-line); color: var(--tdn-text); text-align: left;
  transition: transform .15s ease, border-color .15s ease;
}
.tdn-chip:hover { transform: translateY(-2px); border-color: var(--tdn-accent); }
.tdn-chip-thumb { width: 100%; height: 92px; }
.tdn-chip .tdn-play { width: 30px; height: 30px; margin: -15px 0 0 -15px; }
.tdn-chip-copy { display: flex; align-items: center; gap: 2px; padding: 7px 8px; font-size: 11.5px; color: var(--tdn-sub); white-space: nowrap; }
.tdn-new, .tdn-new-card::after {
  position: absolute; top: 6px; left: 6px; padding: 2px 7px; border-radius: 6px; background: #e5383b; color: #fff;
  font: 800 10.5px/1.4 system-ui, sans-serif; font-style: normal; letter-spacing: .04em; box-shadow: 0 2px 6px rgba(0,0,0,.25);
}

/* 出图记录卡片：未查看高亮 + NEW */
#history-grid .card.tdn-new-card { position: relative; box-shadow: 0 0 0 2px #e5383b, 0 8px 22px rgba(229,56,59,.18) !important; }
#history-grid .card.tdn-new-card::after { content: "NEW · 未查看"; left: 50%; top: 10px; transform: translateX(-50%); z-index: 6; pointer-events: none; white-space: nowrap; }
#history-grid .card.tdn-flash { animation: tdn-flash 1.2s ease 2; }
@keyframes tdn-flash { 0%,100% { box-shadow: 0 0 0 2px transparent; } 50% { box-shadow: 0 0 0 4px #e9b955, 0 0 30px rgba(233,185,85,.6); } }

/* 查看器 */
.tdn-viewer {
  position: relative; width: min(920px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column;
  background: var(--tdn-bg); color: var(--tdn-text); border-radius: 20px; overflow: hidden; box-shadow: var(--tdn-shadow);
  transform: scale(.97); opacity: 0; transition: transform .22s ease, opacity .2s ease;
}
.is-open > .tdn-viewer { transform: none; opacity: 1; }
.tdn-viewer .tdn-x { background: rgba(0,0,0,.45); color: #fff; }
.tdn-viewer-media { background: #0d0d0d; display: grid; place-items: center; min-height: 240px; flex: 1; min-height: 0; }
.tdn-viewer-media video, .tdn-viewer-media img { display: block; max-width: 100%; max-height: calc(100vh - 200px); }
.tdn-viewer-empty { color: #ddd; padding: 60px 24px; font-size: 14px; text-align: center; }
.tdn-viewer-foot { display: flex; gap: 14px; align-items: center; justify-content: space-between; padding: 14px 18px; border-top: 1px solid var(--tdn-line); }
.tdn-viewer-copy { min-width: 0; }
.tdn-viewer-copy p { margin: 4px 0 0; font-size: 13px; line-height: 1.45; color: var(--tdn-text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tdn-viewer-actions { display: flex; gap: 8px; align-items: center; flex: none; }
.tdn-count { font-size: 12px; color: var(--tdn-sub); margin-right: 2px; }

/* 手机 */
@media (max-width: 640px) {
  .tdn-modal-wrap { align-items: end; padding: 0; }
  .tdn-modal { width: 100%; border-radius: 22px 22px 0 0; padding: 22px 16px calc(16px + env(safe-area-inset-bottom)); max-height: 86vh; transform: translateY(40px); }
  .tdn-hero h3 { font-size: 18px; }
  .tdn-item .tdn-thumb, .tdn-item .tdn-thumb.is-video { width: 88px; height: 62px; }
  .tdn-toast-stack { right: 12px; left: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); width: auto; }
  .tdn-toast-thumb { width: 76px; height: 76px; }
  .tdn-pill { top: auto; bottom: calc(84px + env(safe-area-inset-bottom)); font-size: 12.5px; max-width: calc(100vw - 24px); white-space: nowrap; }
  .tdn-viewer-wrap { padding: 0; }
  .tdn-viewer { border-radius: 0; height: 100%; max-height: none; }
  .tdn-viewer-media video, .tdn-viewer-media img { max-height: calc(100vh - 230px); }
  .tdn-viewer-foot { flex-direction: column; align-items: stretch; }
  .tdn-viewer-actions { flex-wrap: wrap; }
  .tdn-viewer-actions .tdn-btn { flex: 1; }
  .tdn-chip { width: 128px; }
  .tdn-chip-thumb { height: 80px; }
}
@media (prefers-reduced-motion: reduce) {
  .tdn-hero-icon, .tdn-dot, .tdn-toast.is-strong::before, .tdn-pill, #history-grid .card.tdn-flash { animation: none !important; }
}

/* ===== 夜间排队时段提示 ===== */
.tdn-nq-hint {
  --tdn-bg: #1d1712; --tdn-text: #fff4e4; --tdn-sub: #d9c7a8; --tdn-accent: #d9a441; --tdn-line: rgba(233, 185, 85, .35);
  display: flex; gap: 12px; align-items: flex-start; margin: 12px auto 0; max-width: 100%;
  padding: 12px 16px; border-radius: 16px; border: 1px solid var(--tdn-line);
  background: linear-gradient(135deg, rgba(40, 30, 60, .78), rgba(29, 23, 18, .82)); color: var(--tdn-text);
  backdrop-filter: blur(10px); box-shadow: 0 8px 24px rgba(0,0,0,.18); animation: tdn-hint-in .3s ease;
}
.tdn-nq-hint.tdn-xcg { --tdn-text: #23254a; --tdn-sub: #5f6390; --tdn-accent: #6f72dc; --tdn-line: rgba(111, 114, 220, .3); background: linear-gradient(135deg, #eef0ff, #f8f5ff); box-shadow: 0 8px 24px rgba(60,60,140,.08); }
.tdn-nq-hint.tdn-xcg.tdn-night { --tdn-text: #eceeff; --tdn-sub: #a9acd6; --tdn-line: rgba(160, 162, 255, .3); background: linear-gradient(135deg, #24264a, #1b1c2e); }
@keyframes tdn-hint-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.tdn-nq-icon { flex: none; width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; background: rgba(127,127,127,.14); color: var(--tdn-accent); }
.tdn-nq-icon svg { width: 18px; height: 18px; }
.tdn-nq-hint b { display: block; font-size: 13.5px; font-weight: 700; margin-bottom: 2px; color: var(--tdn-text); }
.tdn-nq-hint span { font-size: 12.5px; line-height: 1.55; color: var(--tdn-sub); }
.tdn-nq-hint .tdn-nq-icon + div > span { display: block; }

#video-queue-strip.tdn-nq-active .video-progress-row,
#video-queue-strip.tdn-nq-active .video-progress-track { display: none !important; }
#video-queue-strip.tdn-nq-active .video-queue-position-unused::before {
  content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 7px; border-radius: 50%; vertical-align: 1px;
  background: #8f91e3; box-shadow: 0 0 0 3px rgba(143,145,227,.22);
}
.tdn-nq-note { margin-top: 6px; font-size: 12px; line-height: 1.5; opacity: .78; }

#history-grid .card.tdn-nq-card .card-pending-badge,
#history-grid .card.tdn-nq-card .card-pending-video-progress { display: none !important; }
#history-grid .card .tdn-nq-badge {
  position: absolute; left: 10px; right: 10px; bottom: 10px; z-index: 5; pointer-events: none;
  display: grid; gap: 2px; padding: 8px 10px; border-radius: 12px; text-align: left;
  background: rgba(22, 20, 40, .8); color: #f1f1ff; backdrop-filter: blur(6px);
  border: 1px solid rgba(160, 162, 255, .35);
}
#history-grid .card .tdn-nq-badge b { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; white-space: nowrap; }
#history-grid .card .tdn-nq-badge svg { width: 14px; height: 14px; flex: none; color: #b9bbff; }
#history-grid .card .tdn-nq-badge span { font-size: 12px; color: #d5d6ff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 640px) {
  .tdn-nq-hint { padding: 10px 12px; border-radius: 14px; }
  #history-grid .card .tdn-nq-badge { left: 6px; right: 6px; bottom: 6px; padding: 6px 8px; }
}
/* 夜间排队中：原排队文字/进度/计时被原页面每秒刷新，改为隐藏并显示独立的一行，避免闪动 */
#video-queue-strip.tdn-nq-active .video-queue-copy-row { display: none !important; }
body.tdn-nq-on #timer, body.tdn-nq-on #status { display: none !important; }
.tdn-nq-line .tdn-nq-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.tdn-nq-line .tdn-nq-row b { font-size: 14px; font-weight: 700; }
.tdn-nq-line .tdn-nq-row b::before {
  content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; vertical-align: 1px;
  background: #8f91e3; box-shadow: 0 0 0 3px rgba(143,145,227,.22);
}
.tdn-nq-line .tdn-nq-row span { font-size: 13px; opacity: .9; }
.tdn-nq-line { text-align: left; padding: 2px 0; }
.tdn-nq-line .tdn-nq-row b { color: #fff4e4; }
.tdn-nq-line .tdn-nq-row span { color: #f3cd7a; opacity: 1; font-weight: 600; }
body.x-cg-skin .tdn-nq-line .tdn-nq-row b { color: #23254a; }
body.x-cg-skin .tdn-nq-line .tdn-nq-row span { color: #5a5ed0; }
body.x-cg-skin.xcg-night .tdn-nq-line .tdn-nq-row b { color: #eceeff; }
body.x-cg-skin.xcg-night .tdn-nq-line .tdn-nq-row span { color: #b9bbff; }
