/* Generation history follows 10-history.png; records and statistics use local data. */
#historyPageMenu, .hist-quick-search { display: none; }
body[data-tab=history] { --gutter: 36px; --w: 1920px; padding-bottom: 0; }
html:not([data-theme=dark]) body[data-tab=history] { --bg: #f6f7fa; --mu: #969ba5; --line: #eceef3; --tx: #111216; }
body[data-tab=history] #histSec { max-width: var(--w); padding: 26px var(--gutter) 30px; }
.hist-heading { display: flex; justify-content: space-between; align-items: center; gap: 24px; }
body[data-tab=history] .history-title { margin: 0; padding: 0; font-size: 34px; line-height: 44px; font-weight: 700; letter-spacing: -.025em; }
.hist-description { margin: 0; color: var(--mu); font-size: 18px; line-height: 28px; }
body[data-tab=history] #histCount { margin: 0; font-size: inherit; color: inherit; }
body[data-tab=history] #histCount b { color: inherit; font-weight: 400; }
body[data-tab=history] .hist-stats { display: flex; flex: none; gap: 12px; margin: 0; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; font-size: 15px; line-height: 22px; }
.hist-stats > span { display: inline-flex; align-items: center; gap: 7px; min-height: 44px; padding: 10px 16px; border-radius: 18px; background: var(--bg2); color: var(--mu); white-space: nowrap; }
.hist-stats b { color: var(--tx); font-weight: 500; font-variant-numeric: tabular-nums; }
.hist-stats svg { width: 19px; height: 19px; margin-right: 2px; }
body[data-tab=history] .hist-bar { position: relative; top: auto; z-index: 3; margin: 26px 0 30px; padding: 0; background: none; backdrop-filter: none; }
body[data-tab=history] .hist-bar .tbar { gap: 20px; flex-wrap: wrap; }
body[data-tab=history] #histFilter { flex: none; gap: 0; width: 280px; height: 44px; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg2); }
body[data-tab=history] #histFilter button { flex: 1; min-height: 36px; padding: 5px 12px; border-radius: 999px; color: var(--tx); background: transparent; font-size: 16px; line-height: 26px; font-weight: 500; white-space: nowrap; }
body[data-tab=history] #histFilter button.on { background: #ff3654; color: white; box-shadow: none; }
.hist-search { position: relative; flex: 1 1 220px; max-width: 484px; }
.hist-search > svg { position: absolute; top: 12px; left: 17px; width: 21px; height: 21px; color: var(--tx2); pointer-events: none; }
body[data-tab=history] #histQ { width: 100%; height: 44px; padding: 10px 16px 10px 50px; border: 1px solid var(--line); background: var(--bg2); font-size: 15px; }
body[data-tab=history] #histQ:focus { border-color: var(--ac); }
.hist-actions { display: flex; align-items: center; flex: none; gap: 22px; }
body[data-tab=history] .hist-sel-all { justify-content: center; min-height: 44px; padding: 9px 15px; gap: 9px; border-radius: 18px; background: var(--sf); color: var(--tx); font-size: 16px; }
body[data-tab=history] #histSelAll { width: 19px; height: 19px; }
body[data-tab=history] .hist-actions > button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 22px; border: 1px solid var(--line); border-radius: 18px; background: var(--bg2); color: var(--tx); font-size: 16px; line-height: 22px; font-weight: 500; white-space: nowrap; }
body[data-tab=history] #histBar #histZip { color: white; background: #ff3654; border-color: #ff3654; }
body[data-tab=history] #histZip:disabled { opacity: .8; }
body[data-tab=history] .hist-actions > button:hover:not(:disabled) { filter: brightness(.97); }
.hist-actions > button svg { width: 20px; height: 20px; flex: none; }
body[data-tab=history] #histSelN { position: absolute; top: calc(100% + 3px); right: 0; font-size: 12px; line-height: 20px; }
body[data-tab=history] #histGrid { grid-template-columns: repeat(5,minmax(0,1fr)); gap: 16px 18px; padding: 0; align-items: start; min-height: 0; }
body[data-tab=history] .hist-card { position: relative; padding: 11px 11px 13px; border: 1px solid var(--line); border-radius: 16px; background: var(--bg2); box-shadow: none; animation: none; }
body[data-tab=history] .hist-card:hover { transform: none; box-shadow: none; border-color: var(--line2); }
body[data-tab=history] .hist-card.selected { border-color: var(--ac); box-shadow: 0 0 0 1px var(--ac); }
body[data-tab=history] .hist-card:has(.hist-menu[open]) { z-index: 6; }
body[data-tab=history] .hist-card .hph { aspect-ratio: 284 / 231; overflow: visible; border-radius: 7px; transform: none; box-shadow: none; }
body[data-tab=history] .hist-card .hph img { position: absolute; inset: 0; object-fit: cover; object-position: center 30%; }
body[data-tab=history] .hist-card .hsel { top: 10px; left: 10px; width: 22px; height: 22px; border: 1px solid #d2d5da; border-radius: 5px; background: #fff; box-shadow: none; }
body[data-tab=history] .hist-card .hsel:checked { border-color: var(--ac); background: var(--ac) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 12 4 4 8-8'/%3E%3C/svg%3E") center / 16px no-repeat; transform: none; }
body[data-tab=history] .hist-card .hinfo { padding: 11px 5px 0; }
body[data-tab=history] .hist-card h3 { font-size: 15px; line-height: 23px; font-weight: 600; }
.hist-card-bottom { display: flex; align-items: center; gap: 4px; min-width: 0; }
body[data-tab=history] .hist-card .sub { flex: 1; margin: 0; font-size: 13px; line-height: 22px; overflow: visible; white-space: nowrap; }
.hist-card-actions { display: flex; flex: none; align-items: center; gap: 6px; }
body[data-tab=history] .hist-card-actions .icon, .hist-menu summary { display: flex; align-items: center; justify-content: center; width: 29px; height: 29px; padding: 5px; border: 0; border-radius: 8px; background: transparent; color: #797e89; box-shadow: none; cursor: pointer; }
body[data-tab=history] .hist-card-actions .icon:hover, .hist-menu summary:hover, .hist-menu[open] summary { background: var(--sf); color: var(--tx); }
.hist-stats svg, .hist-search svg, .hist-actions svg, .hist-card-actions svg, .hist-menu svg { fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.hist-card-actions svg, .hist-menu svg { width: 19px; height: 19px; }
.hist-menu { position: relative; }
.hist-menu summary { list-style: none; }
.hist-menu summary::-webkit-details-marker { display: none; }
.hist-menu summary svg { fill: currentColor; }
.hist-menu-image { position: absolute; top: 8px; right: 8px; z-index: 3; }
.hist-menu-image summary { width: 29px; height: 29px; border-radius: 50%; background: color-mix(in srgb,var(--bg2) 88%,transparent); color: var(--tx2); }
.hist-menu-panel { position: absolute; top: calc(100% + 5px); right: 0; z-index: 10; width: 190px; max-width: calc(100vw - 32px); padding: 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg2); box-shadow: var(--sh2); }
.hist-menu-panel button { display: block; width: 100%; min-height: 38px; padding: 8px 10px; border-radius: 6px; background: transparent; color: var(--tx); font-size: 14px; line-height: 22px; text-align: left; white-space: normal; }
.hist-menu-panel button:hover { background: var(--sf); }
.hist-menu-panel [data-act=del] { color: var(--ac); }
body[data-tab=history] #histEmpty { margin-top: 30px; }

@media (min-width: 1280px) {
  body[data-tab=history] #top { grid-template: 'brand nav context search tools' 75px / auto auto auto minmax(150px,1fr) auto; gap: 0; padding-inline: 54px; background: var(--bg2); }
  body[data-tab=history] .brand { gap: 10px; }
  body[data-tab=history] .mark { width: 36px; height: 36px; background: none; box-shadow: none; }
  body[data-tab=history] .mark svg,
  body[data-tab=history] .mark .pose-brand { display: none; }
  body[data-tab=history] .mark .costume-brand { display: block; width: 36px; height: 36px; object-fit: contain; }
  body[data-tab=history] .wm { display: flex; flex-direction: row; align-items: baseline; gap: 6px; }
  body[data-tab=history] .wm b,
  body[data-tab=history] .wm small { color: var(--tx); font-size: 18px; line-height: 26px; font-weight: 550; letter-spacing: 0; }
  body[data-tab=history] .wm small::before { content: '/ '; }
  body[data-tab=history] .tabs { align-self: stretch; margin-left: 86px; gap: 58px; }
  body[data-tab=history] .tabs .shell-menu { height: 100%; }
  body[data-tab=history] .tabs .nav-trigger { height: 100%; min-height: 0; padding: 0; border-radius: 0; background: none; color: var(--mu); font-size: 18px; font-weight: 500; }
  body[data-tab=history] .tabs .nav-trigger > svg { display: none; }
  body[data-tab=history] .tabs .current > .nav-trigger { color: var(--tx); font-weight: 650; }
  body[data-tab=history] .tabs .current > .nav-trigger::after { bottom: 0; width: 54px; height: 2px; border-radius: 0; }
  body[data-tab=history] .shell-context { display: flex; align-items: center; gap: 28px; height: 28px; margin-left: 30px; padding-left: 28px; border-left: 1px solid var(--line); font-size: 18px; }
  body[data-tab=history] #creativeSpaceMenu summary { position: relative; color: var(--tx2); }
  body[data-tab=history] #creativeSpaceMenu summary > svg { display: none; }
  body[data-tab=history] #creativeSpaceMenu summary::after { content: '›'; position: absolute; right: -19px; color: var(--mu); font-size: 24px; }
  body[data-tab=history] #shellPage { display: none; }
  body[data-tab=history] #historyPageMenu { display: block; color: var(--tx); font-weight: 600; white-space: nowrap; }
  body[data-tab=history] #historyPageMenu summary > span { color: var(--tx); }
  body[data-tab=history] #top .search { display: block !important; width: 286px; max-width: calc(100% - 32px); justify-self: end; }
  body[data-tab=history] #q { min-height: 44px; padding-left: 54px; border: 0; border-radius: 999px; background: var(--bg); font-size: 16px; }
  body[data-tab=history] #q:not(:focus)::placeholder { color: transparent; }
  body[data-tab=history] .sic { left: 20px; width: 21px; height: 21px; color: var(--mu); }
  body[data-tab=history] .q-kbd { left: 54px; right: auto; border: 0; background: none; box-shadow: none; color: var(--mu); font: 500 15px/1 var(--sans); }
  body[data-tab=history] .hist-quick-search { display: inline; }
  body[data-tab=history] .search:focus-within .q-kbd { display: none; }
  body[data-tab=history] .tools { margin-left: 20px; gap: 24px; }
  body[data-tab=history] .tools > :is(#adultSw,#languageMenu,#themeMenu) { display: flex; }
  body[data-tab=history] .tools #trayFab, body[data-tab=history] .tools .settings-label, body[data-tab=history] #favoriteLocale { display: none; }
  body[data-tab=history] .tools .icon { width: 28px; height: 30px; padding: 0; border: 0; border-radius: 0; background: none; }
  body[data-tab=history] .tools .icon svg { width: 25px; height: 25px; }
  body[data-tab=history] .tools > :is(#languageMenu,#themeMenu) { padding-left: 24px; border-left: 1px solid var(--line2); }
  body[data-tab=history] .asw { height: 40px; padding: 4px 12px; gap: 8px; border: 1px solid var(--line); border-radius: 999px; font-size: 17px; }
  body[data-tab=history] .asw b { order: -1; font-weight: 400; }
  body[data-tab=history] .asw .trk { width: 34px; height: 22px; background: var(--line2); }
  body[data-tab=history] .asw .kn { width: 18px; height: 18px; top: 2px; left: 2px; }
  body[data-tab=history] .asw[aria-checked=true] .trk { background: var(--ac); }
  body[data-tab=history] .asw[aria-checked=true] .kn { transform: translateX(12px); }
}
@media (min-width: 1280px) and (max-width: 1500px) {
  body[data-tab=history] #top { padding-inline: 36px; }
  body[data-tab=history] .tabs { margin-left: 40px; gap: 30px; }
  body[data-tab=history] .shell-context { margin-left: 24px; padding-left: 24px; font-size: 16px; }
  body[data-tab=history] .tools { margin-left: 16px; gap: 18px; }
  body[data-tab=history] .tools > :is(#languageMenu,#themeMenu) { padding-left: 18px; }
}
@media (min-width: 1280px) {
  html:not(:lang(zh-CN)) body[data-tab=history] .tabs { margin-left: 32px; gap: 24px; }
  html:not(:lang(zh-CN)) body[data-tab=history] :is(.tabs .nav-trigger,.shell-context) { font-size: 15px; }
}
@media (max-width: 1500px) {
  body[data-tab=history] #histFilter { width: 240px; }
  .hist-actions { gap: 12px; }
  body[data-tab=history] .hist-actions > button { padding-inline: 15px; }
  .hist-card-bottom { flex-wrap: wrap; }
  .hist-card-actions { margin-left: auto; }
}
@media (max-width: 1279px) {
  body[data-tab=history] { --gutter: 24px; }
  body[data-tab=history] #histGrid { grid-template-columns: repeat(4,minmax(0,1fr)); }
  .hist-heading { align-items: flex-start; flex-wrap: wrap; gap: 16px; }
  .hist-description { font-size: 15px; line-height: 24px; }
  body[data-tab=history] .hist-stats { gap: 8px; font-size: 13px; }
  .hist-stats > span { padding: 8px 12px; }
  body[data-tab=history] .hist-bar .tbar { gap: 14px; }
  .hist-actions { width: 100%; justify-content: flex-end; }
  body[data-tab=history] #histSelN { position: static; }
  body[data-tab=history] .hist-bar .sp { display: none; }
  .hist-search { max-width: none; }
}
@media (max-width: 900px) {
  body[data-tab=history] #histGrid { grid-template-columns: repeat(3,minmax(0,1fr)); }
}
@media (max-width: 600px) {
  body[data-tab=history] { --gutter: 16px; }
  body[data-tab=history] #histSec { padding-top: 20px; }
  body[data-tab=history] .history-title { font-size: 28px; line-height: 38px; }
  .hist-description { font-size: 12px; line-height: 22px; }
  .hist-heading { gap: 14px; }
  body[data-tab=history] .hist-stats { width: 100%; justify-content: space-between; gap: 6px; font-size: 11px; }
  .hist-stats > span { flex: 1; min-width: 0; flex-wrap: wrap; justify-content: center; gap: 3px; padding: 8px 5px; border-radius: 12px; white-space: normal; }
  .hist-stats svg { width: 15px; height: 15px; }
  body[data-tab=history] .hist-bar { margin: 18px 0 22px; }
  body[data-tab=history] #histFilter { width: 100%; }
  .hist-search { flex-basis: 100%; }
  body[data-tab=history] .hist-bar .tbar { gap: 10px; }
  .hist-actions { flex-wrap: wrap; justify-content: flex-start; gap: 6px; }
  body[data-tab=history] .hist-sel-all { padding: 7px 8px; gap: 5px; font-size: 12px; }
  body[data-tab=history] .hist-actions > button { flex: 1; min-height: 44px; padding: 7px 8px; gap: 4px; font-size: 12px; }
  .hist-actions > button svg { width: 16px; height: 16px; }
  body[data-tab=history] #histGrid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px 10px; }
  body[data-tab=history] .hist-card { padding: 7px 7px 8px; border-radius: 12px; }
  body[data-tab=history] .hist-card .hinfo { padding: 8px 1px 0; }
  body[data-tab=history] .hist-card h3 { font-size: 13px; line-height: 22px; }
  body[data-tab=history] .hist-card .sub { flex-basis: 100%; font-size: 10px; line-height: 20px; }
  .hist-card-actions { justify-content: flex-end; gap: 0; }
  body[data-tab=history] .hist-card-actions .icon, .hist-menu-footer summary { width: 32px; height: 34px; padding: 7px; }
  body[data-tab=history] .hist-card .hsel { top: 7px; left: 7px; }
  .hist-menu-image { top: 5px; right: 5px; }
  .hist-card:nth-child(2n+1) .hist-menu-panel { right: auto; left: -80px; }
  .hist-card:nth-child(2n+1) .hist-menu-image .hist-menu-panel { left: -100px; }
}
@media (pointer: coarse) {
  body[data-tab=history] .hist-card-actions .icon, .hist-menu-footer summary { min-width: 40px; min-height: 44px; }
  .hist-menu-panel button { min-height: 44px; }
}

/* Empty history follows 11-history-empty.png without affecting saved records. */
html:not([data-theme=dark]) body[data-tab=history].history-empty { --bg: #f6f7fa; --tx: #303540; --mu: #7d8596; }
body[data-tab=history].history-empty #histSec { display: grid; place-items: center; min-height: calc(100dvh - var(--hdr) - var(--personal-nav-height,0px)); padding: 32px var(--gutter) 73px; }
body[data-tab=history].history-empty :is(.hist-heading,#histGrid) { display: none; }
body[data-tab=history].history-empty > .foot { display: none; }
body[data-tab=history].history-empty #histEmpty { display: flex; flex-direction: column; align-items: center; width: 100%; max-width: 720px; margin: 0; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; }
.hist-empty-art { display: block; width: 400px; max-width: 100%; height: auto; margin: 0 0 22px; }
body[data-tab=history] #histEmpty h2 { margin: 0; color: var(--tx); font-size: 32px; line-height: 48px; font-weight: 600; letter-spacing: 0; }
body[data-tab=history] #histEmpty p { max-width: 100%; margin: 8px 0 26px; color: var(--mu); font-size: 24px; line-height: 36px; }
body[data-tab=history] #histEmpty > button { display: inline-flex; align-items: center; justify-content: center; gap: 16px; min-width: 220px; min-height: 62px; padding: 12px 30px; border: 0; border-radius: 20px; background: #ff173d; color: #fff; font-size: 24px; line-height: 36px; font-weight: 400; box-shadow: none; }
body[data-tab=history] #histEmpty > button:hover { background: var(--ac2); }
body[data-tab=history] #histEmpty > button svg { width: 24px; height: 24px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
[data-theme=dark] .hist-empty-art { mix-blend-mode: screen; filter: contrast(1.1) invert(1) hue-rotate(180deg); opacity: .9; }

@media (min-width: 1280px) {
  body[data-tab=history].history-empty #top { grid-template-rows: 85px; padding-inline: 36px; }
  body[data-tab=history].history-empty .brand { gap: 10px; }
  body[data-tab=history].history-empty .mark,
  body[data-tab=history].history-empty .mark .costume-brand { width: 36px; height: 36px; }
  body[data-tab=history].history-empty .mark .pose-brand { display: none; }
  body[data-tab=history].history-empty .wm { display: flex; flex-direction: row; align-items: baseline; gap: 6px; }
  body[data-tab=history].history-empty .wm b,
  body[data-tab=history].history-empty .wm small { color: var(--tx); font-size: 18px; line-height: 26px; font-weight: 550; letter-spacing: 0; }
  body[data-tab=history].history-empty .wm small::before { content: '/ '; }
  body[data-tab=history].history-empty .tabs { margin-left: 63px; gap: 37px; }
  body[data-tab=history].history-empty .tabs .nav-trigger { font-size: 20px; color: var(--tx); }
  body[data-tab=history].history-empty .tabs [data-tab=studio]::after { content: ''; position: absolute; left: 50%; bottom: 0; width: 58px; height: 3px; border-radius: 999px; background: var(--ac); transform: translateX(-50%); }
  body[data-tab=history].history-empty .shell-context { height: 32px; margin-left: 41px; padding-left: 40px; gap: 24px; font-size: 20px; }
  body[data-tab=history].history-empty #creativeSpaceMenu summary { display: flex; align-items: center; gap: 8px; color: var(--mu); }
  body[data-tab=history].history-empty #creativeSpaceMenu summary > svg { display: block; width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; }
  body[data-tab=history].history-empty #creativeSpaceMenu summary::after { content: none; }
  body[data-tab=history].history-empty #historyPageMenu { padding-left: 22px; border-left: 1px solid var(--line2); }
  body[data-tab=history].history-empty #historyPageMenu summary > svg { display: none; }
  body[data-tab=history].history-empty #top .search { width: 390px; }
  body[data-tab=history].history-empty #q { height: 48px; padding-left: 52px; font-size: 16px; }
  body[data-tab=history].history-empty #q:not(:focus)::placeholder { color: var(--mu); }
  body[data-tab=history].history-empty .q-kbd { left: auto; right: 16px; padding: 5px 7px; border-radius: 6px; background: var(--sf); }
  body[data-tab=history].history-empty .hist-quick-search { display: none; }
  body[data-tab=history].history-empty .tools { margin-left: 48px; gap: 26px; }
  body[data-tab=history].history-empty .tools > :is(#languageMenu,#themeMenu) { padding-left: 18px; }
  body[data-tab=history].history-empty .asw { height: 40px; padding: 0; gap: 10px; border: 0; font-size: 18px; }
  body[data-tab=history].history-empty .asw .trk { width: 44px; height: 26px; }
  body[data-tab=history].history-empty .asw .kn { width: 20px; height: 20px; top: 3px; left: 3px; }
  body[data-tab=history].history-empty .asw[aria-checked=true] .kn { transform: translateX(18px); }
}
@media (min-width: 1280px) and (max-width: 1500px) {
  body[data-tab=history].history-empty .tabs { margin-left: 32px; gap: 28px; }
  body[data-tab=history].history-empty .shell-context { margin-left: 28px; padding-left: 24px; gap: 18px; }
  body[data-tab=history].history-empty :is(.tabs .nav-trigger,.shell-context) { font-size: 17px; }
  body[data-tab=history].history-empty .tools { margin-left: 24px; gap: 20px; }
  body[data-tab=history].history-empty .tools > :is(#languageMenu,#themeMenu) { padding-left: 20px; }
}
@media (min-width: 1280px) {
  html:not(:lang(zh-CN)) body[data-tab=history].history-empty .tabs { margin-left: 32px; gap: 24px; }
  html:not(:lang(zh-CN)) body[data-tab=history].history-empty :is(.tabs .nav-trigger,.shell-context) { font-size: 15px; }
}
@media (max-width: 600px) {
  body[data-tab=history].history-empty #histSec { padding: 24px 16px 48px; }
  .hist-empty-art { width: 300px; margin-bottom: 16px; }
  body[data-tab=history] #histEmpty h2 { font-size: 25px; line-height: 38px; }
  body[data-tab=history] #histEmpty p { max-width: 340px; margin: 8px 0 24px; font-size: 16px; line-height: 26px; }
  body[data-tab=history] #histEmpty > button { min-width: 180px; min-height: 52px; padding: 10px 24px; gap: 12px; border-radius: 16px; font-size: 18px; line-height: 30px; }
}
