:root {
  --px-sword: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAsklEQVR42mNgIAPIysr/l5WV/89AruaTF6/9P3nx2n9ZWfn/TKRqXrNlOwMDAwODtqoMAwMDAwMTuZp5uPgYyXL2l2+fSPM//TSjRw2xmlECcVoeRCOymLaqDIOmui7D48cPGYly8uZuiEvI8jOyIcRqZkHXHGfEzZA16SvDNAZdoixkQtd8/+U7BgYGBgbfUoifYV7CZQAjuubDT9lRAgymGVcgwr2ATTM+jVgDj5zcCQCBOY+2x5IWvgAAAABJRU5ErkJggg==);
  --px-grass: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAw0lEQVR42q2TPQrCQBBGX4LtgoWFIEHtg4ew3mt4IVs7z2DtGRYvoBIEixRpU2khEzf7RzBOtfO+/WZnBhZGRgZQFMvXL+aqumcTSbaHRU+8XWpWm5lnEn7ePQDIXVHCNsd4r4BUlsvlsY1yu2A3gjaKEzXaKDBfs+QlH71EoY1iT+uPoI3i+mx6OdAxyYMjSKzn0+4sxhDzCthCyCjcZXnoZTm7r4W4N4Itxlq3eXIHqdaTOxjaSXQHQ/bwt8809jfzBv1Ba8oLPkr6AAAAAElFTkSuQmCC);
  --px-potion: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAvElEQVR42mNkwAFkZeX/I/MfP37IiE0dEwMeEGfEzRBnxM1AFpCVlf9/8uK1/ycvXvuP7hqCLpCVlf9//eZlOD+3qoEBlyE4vXD19hOiXMqIy3ZsBoT4eGIEJiNWzZmYmo/dPsHAwMDA0Pe4EcUQJlyatafLoBhgpWrBYKVqwVAkW48SHihhgM1mQgB3IOLxBtEJCR1YqVrgNwCbDYTkMWKhSLYewzZkjeixwIgrE8EMQtaILVMxUpobKQYAqjdajhx9tmwAAAAASUVORK5CYII=);
  --px-paint: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAvklEQVR42mNgoBAwInNkZeX/41P8+PFDRpwGyMrK/79+8zJe2zTVdTEMYkTW/DTEg4GBgYFBes0OBgYGBobuu98YGBgYGEqVuTAMghnCRGkYsCBzYDbDALrNX86HYhiA4oLsQx4M2Yc8yHcBrkCDBS6P4Woon4FBU133PzwwZWXl/3/59gkFI0cpPnkWWLRoqusSjEYGBgaGq5lPsIcB1BC4xPWblxlkZeX/E0ofGCmL2AQF8z8jNgXkJOkhDADSWGvTOjJ7XwAAAABJRU5ErkJggg==);
  --px-bolt: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAdElEQVR42mNgoBAwEqNIVlb+P4z9+PFDFD1MxGg+vUKD4fQKDdKdJysr///FUff/L466/0d2BVU1M+FzNroYNoMYidGMDEwjbqAEJCO+EGdgYEAJPHTNeKMR3SXYNBMdBrg0E5UO8GmmStwzUc1mQvE9eAEAyb5OzBe/MQIAAAAASUVORK5CYII=);
  --px-star: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAnElEQVR42r1SsQ3DMAyjjIx5wciaNYNPKeATDeQUP5DV0CHuZFR1XSYZWm4WJJKiBfwS3i/V+6WyHndGktMKRuKYek7rqUt3ZRXmYmpqVzOxb9Uik1X5hnnbkdPjrRbi8XKgWiRE1BHRvO0fhG0YAORueCEeUC1yK0QGYerWal9vLhyz2vLpyYZ3YNX74Z7E3oWM/tiGxG6B9f0PT/NRSzvf03JJAAAAAElFTkSuQmCC);
  --px-chest: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAlElEQVR42mNgGGjACGPIysr/J0Xj48cPGRkYGBhYkAXjjLiJ0rzo3Fc4mwVdUoCbE6/mD1+/o/CZKA0DFkynIZx3eoUGAwMDA4NpxA3iDLCV/okiaRpxg2FaHqbc4afs2A1QFBdCMeDw068MplYaDAyTbqDIHX76FXs0xhlxExWIi859hUcjxYFI3VjAFs9kRONQAwDVEi5JSwVOJgAAAABJRU5ErkJggg==);
  --px-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAkklEQVR42mNgoBAwMjAwMMjKyv8nR/Pjxw8ZWWCcOCNukjQvOveVgYGBgYEFWTB25jGiNC9Ot4KzmYjRIHA3nEHgbjhWOSZKA5GFGEUflFfilMPpgvYLXkS5gAmfZmRDcBnIRMjm9gteWA3EagCyggeX3mAofnDpDYYhLOgK8PFhYjJI2lAMsDnKQn40wpLm0AMAQWYvVGpPyIsAAAAASUVORK5CYII=);
}
.px-sword, .tx-ico-sword { background-image: var(--px-sword); }
.px-grass, .tx-ico-grass { background-image: var(--px-grass); }
.px-potion, .tx-ico-potion { background-image: var(--px-potion); }
.px-paint, .tx-ico-paint { background-image: var(--px-paint); }
.px-bolt, .tx-ico-bolt { background-image: var(--px-bolt); }
.px-star, .tx-ico-star { background-image: var(--px-star); }
.px-chest, .tx-ico-chest { background-image: var(--px-chest); }
.px-image, .tx-ico-image { background-image: var(--px-image); }
/* 贴图工坊（2026-10-25 整页重写）。MC 方块风：方角、像素斜面、物品栏格子、经验条进度。
   颜色全部走站点令牌（tokens.css），深浅主题和皮肤自动跟随。图标是自己画的 16×16 像素图。 */

/* ---------------------------------------------------------------- 基础 */
html, body { height: 100%; }
body.tx-page {
  margin: 0; display: flex; flex-direction: column; height: var(--am-view, 100dvh); min-height: 0; overflow: hidden;
  font-family: var(--font); color: var(--text); background: var(--page);
  -webkit-font-smoothing: antialiased;
}
.tx-page [hidden] { display: none !important; }
.tx-page button, .tx-page input, .tx-page textarea { font: inherit; color: inherit; }
.tx-page :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tx-spacer { flex: 1; }
.tx-ico, .px { display: inline-block; width: 16px; height: 16px; flex: none; background-size: 100% 100%; background-repeat: no-repeat; image-rendering: pixelated; vertical-align: -3px; }

/* ---------------------------------------------------------------- MC 组件 */
.tx-panel {
  background: var(--surface); border: 2px solid var(--border-strong); border-radius: 3px;
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--surface) 70%, #fff), 0 3px 0 var(--slot-inset);
}
.txb {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; flex: none;
  min-height: 34px; padding: 0 14px; font-size: 13px; font-weight: 650; letter-spacing: .01em; white-space: nowrap;
  color: var(--text); background: var(--surface-hover); cursor: pointer; text-decoration: none;
  border: 2px solid var(--border-strong); border-radius: 3px;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .35), inset 0 -3px 0 rgba(0, 0, 0, .13);
  transition: border-color .12s, background .12s, transform .05s;
}
.txb:hover:not(:disabled) { border-color: var(--accent); background: var(--slot-hover); }
.txb:active:not(:disabled) { transform: translateY(1px); box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .13); }
.txb:disabled { opacity: .5; cursor: not-allowed; }
.txb.txb-primary {
  color: var(--on-accent); background: var(--accent); border-color: color-mix(in srgb, var(--accent) 62%, #000);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .3), inset 0 -3px 0 rgba(0, 0, 0, .28);
}
.txb.txb-primary:hover:not(:disabled) { background: var(--accent-hover); border-color: color-mix(in srgb, var(--accent) 50%, #000); }
.txb.txb-danger { color: var(--danger); }
.txb.txb-sm { min-height: 28px; padding: 0 10px; font-size: 12px; }
.txb.on { border-color: var(--accent); background: var(--slot-selected); }
.tx-tip {
  color: #f6f1ff; background: #1b0f26f2; border: 2px solid #12061c; border-radius: 3px;
  box-shadow: inset 0 0 0 2px #4b2290, 0 8px 24px rgba(0, 0, 0, .35);
}
.tx-xp { position: relative; height: 12px; background: #1e211d; border: 2px solid #0b0c0b; border-radius: 2px; overflow: hidden; }
.tx-xp i {
  position: absolute; inset: 0 auto 0 0; width: 0;
  background: linear-gradient(#a8f05a, #6bcf2a 55%, #3f9a18);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .25);
  transition: width .5s linear;
}
.tx-xp::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 calc(10% - 2px), #0b0c0b calc(10% - 2px) 10%); }
.tx-spin { display: inline-block; width: 14px; height: 14px; flex: none; border: 3px solid var(--accent); border-right-color: transparent; border-bottom-color: transparent; animation: tx-spin .8s steps(8) infinite; }
@keyframes tx-spin { to { transform: rotate(360deg); } }

/* 物品栏格子 */
.tx-slot {
  position: relative; display: grid; place-items: center; padding: 4px; cursor: pointer; overflow: hidden;
  background: var(--slot); border: 2px solid var(--slot-border); border-radius: 2px;
  box-shadow: inset 2px 2px 0 var(--slot-inset), inset -2px -2px 0 color-mix(in srgb, var(--slot) 40%, #fff);
}
.tx-slot:hover { background: var(--slot-hover); }
.tx-slot.on { background: var(--slot-selected); border-color: var(--accent); }
.tx-slot img { max-width: 100%; max-height: 100%; object-fit: contain; opacity: 0; transition: opacity .2s; }
.tx-slot img.ready { opacity: 1; }
.tx-slot img.is-pixel { width: 100%; height: 100%; image-rendering: pixelated; }
.tx-slot.is-broken::after { content: "未加载"; font-size: 11px; color: var(--text-muted); }

/* ---------------------------------------------------------------- 顶栏 */
.tx-top {
  position: relative; z-index: 5; display: flex; align-items: center; gap: 12px; flex: none;
  min-height: 56px; padding: 0 16px; background: var(--surface); border-bottom: 2px solid var(--border-strong);
}
.tx-top::after {
  content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 5px; pointer-events: none;
  background: linear-gradient(#5fb83a 0 3px, #7b5434 3px 5px);
  -webkit-mask: repeating-linear-gradient(90deg, #000 0 5px, rgba(0, 0, 0, .78) 5px 9px, #000 9px 14px);
  mask: repeating-linear-gradient(90deg, #000 0 5px, rgba(0, 0, 0, .78) 5px 9px, #000 9px 14px);
}
.tx-back { color: var(--text-secondary); text-decoration: none; font-size: 13px; white-space: nowrap; }
.tx-back:hover { color: var(--accent); }
.tx-brand { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.tx-brand b { font-size: 16px; letter-spacing: .02em; }
.tx-logo { width: 26px; height: 26px; background: var(--px-grass) center / 100% 100% no-repeat; image-rendering: pixelated; }
.tx-tabs { display: flex; gap: 4px; margin-left: 8px; }
.tx-tabs button {
  display: inline-flex; align-items: center; gap: 7px; min-height: 38px; padding: 0 14px; cursor: pointer;
  font-size: 14px; font-weight: 650; color: var(--text-secondary); white-space: nowrap;
  background: transparent; border: 2px solid transparent; border-radius: 3px;
}
.tx-tabs button:hover { color: var(--text); background: var(--surface-hover); }
.tx-tabs button[aria-selected="true"] {
  color: var(--text); background: var(--slot-selected); border-color: var(--accent);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .35), inset 0 -3px 0 rgba(0, 0, 0, .1);
}
.tx-tabs .tx-ico { width: 18px; height: 18px; }
.tx-count { min-width: 18px; padding: 0 5px; font-size: 11px; line-height: 18px; text-align: center; color: var(--on-accent); background: var(--accent); border-radius: 2px; }
.tx-count:empty { display: none; }
.tx-top-tools { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.tx-balance { font-size: 12px; color: var(--text-secondary); padding: 4px 8px; border: 1px solid var(--border); border-radius: 3px; white-space: nowrap; }
.tx-icon-btn { width: 32px; height: 32px; display: grid; place-items: center; cursor: pointer; font-weight: 800; color: var(--text-secondary); background: transparent; border: 2px solid var(--border); border-radius: 3px; }
.tx-icon-btn:hover { color: var(--accent); border-color: var(--accent); }
#txFeedback { color: #fff; background: #d2552f; border-color: #8f3218; box-shadow: inset 0 2px 0 rgba(255, 255, 255, .3), inset 0 -2px 0 rgba(0, 0, 0, .25); }
.tx-embedded .tx-top { padding-left: 10px; }

/* ---------------------------------------------------------------- 主区 */
.tx-main { position: relative; flex: 1; min-height: 0; padding-top: 5px; }
.tx-view { position: absolute; inset: 5px 0 0; min-height: 0; }
.tx-quick { display: grid; grid-template-columns: minmax(0, 1fr) 372px; gap: 14px; padding: 14px; }
.tx-stage-col { display: flex; flex-direction: column; gap: 10px; min-width: 0; min-height: 0; }
.tx-stage { position: relative; flex: 1; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.tx-canvas {
  position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: hidden;
  background-color: var(--checker-b);
  background-image: linear-gradient(45deg, var(--checker-a) 25%, transparent 25%), linear-gradient(-45deg, var(--checker-a) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--checker-a) 75%), linear-gradient(-45deg, transparent 75%, var(--checker-a) 75%);
  background-size: 16px 16px; background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}
.tx-canvas:not(.has-image) { background: var(--stage); }
.tx-frame { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 18px; }
.tx-frame.is-zoomed { overflow: auto; display: block; text-align: center; }
.tx-frame.is-zoomed img { max-width: none; max-height: none; margin: auto; display: block; }
.tx-main-img { max-width: 100%; max-height: 100%; object-fit: contain; user-select: none; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .16)); }
.tx-main-img.is-pixel { image-rendering: pixelated; }
.tx-frame:not(.is-zoomed) .tx-main-img.is-pixel { width: 100%; height: 100%; }
.tx-frame-label { position: absolute; left: 10px; bottom: 8px; padding: 3px 7px; font-size: 11px; color: var(--text-secondary); background: var(--surface); border: 1px solid var(--border); border-radius: 2px; }
.tx-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 13px; color: var(--text-secondary); background: color-mix(in srgb, var(--surface) 55%, transparent); }
.tx-loading.is-error { cursor: pointer; color: var(--danger); }
.tx-stage-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 8px 10px; background: var(--surface); border-top: 2px solid var(--border); }
.tx-zoom, .tx-variant, .tx-seg { display: inline-flex; flex-wrap: wrap; gap: 3px; }
.tx-seg-btn {
  min-height: 28px; padding: 0 9px; font-size: 12px; font-weight: 600; cursor: pointer; color: var(--text-secondary);
  background: var(--surface-sunken); border: 2px solid var(--border); border-radius: 2px;
}
.tx-seg-btn:hover:not(:disabled) { color: var(--text); border-color: var(--border-hover); }
.tx-seg-btn.on { color: var(--text); background: var(--slot-selected); border-color: var(--accent); }
.tx-seg-btn:disabled { opacity: .5; cursor: not-allowed; }
.tx-variant-label { font-size: 12px; color: var(--text-muted); }
.tx-strip { display: flex; gap: 6px; overflow-x: auto; flex: none; padding: 2px 2px 4px; }
.tx-strip .tx-slot { width: 64px; height: 64px; flex: none; }
.tx-slot-more { font-weight: 700; color: var(--text-secondary); }

/* 空画布 */
.tx-empty { max-width: 520px; padding: 28px; text-align: center; }
.tx-empty h2 { margin: 14px 0 6px; font-size: 21px; }
.tx-empty p { margin: 0 auto; color: var(--text-secondary); line-height: 1.7; font-size: 14px; }
.tx-empty-art { display: flex; justify-content: center; gap: 14px; }
.tx-empty-art .px { width: 56px; height: 56px; animation: tx-bob 2.4s ease-in-out infinite; filter: drop-shadow(0 5px 0 rgba(0, 0, 0, .12)); }
.tx-empty-art .px:nth-child(2) { animation-delay: .3s; }
.tx-empty-art .px:nth-child(3) { animation-delay: .6s; }
@keyframes tx-bob { 50% { transform: translateY(-6px); } }
.tx-steps { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin: 18px 0 0; padding: 0; list-style: none; font-size: 13px; color: var(--text-secondary); }
.tx-steps li { display: flex; align-items: center; gap: 6px; padding: 6px 10px; background: var(--surface); border: 2px solid var(--border); border-radius: 3px; }
.tx-steps b { display: grid; place-items: center; width: 20px; height: 20px; font-size: 12px; color: var(--on-accent); background: var(--accent); border-radius: 2px; }
.tx-examples { display: grid; gap: 7px; margin-top: 18px; text-align: left; }
.tx-example { padding: 10px 12px; font-size: 13px; line-height: 1.5; cursor: pointer; color: var(--text); background: var(--surface); border: 2px solid var(--border); border-radius: 3px; text-align: left; }
.tx-example:hover { border-color: var(--accent); background: var(--accent-soft); }

/* ---------------------------------------------------------------- 快速生成：右栏 */
.tx-compose { display: flex; flex-direction: column; min-width: 0; gap: 14px; padding: 16px; overflow-y: auto; min-height: 0; }
.tx-compose.drop { border-color: var(--accent); background: var(--accent-soft); }
.tx-field { display: grid; gap: 7px; }
.tx-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tx-label { font-size: 13px; font-weight: 700; color: var(--text); }
.tx-kinds { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.tx-kinds button {
  display: grid; justify-items: center; gap: 3px; padding: 10px 4px 8px; cursor: pointer; text-align: center;
  background: var(--slot); border: 2px solid var(--slot-border); border-radius: 3px;
  box-shadow: inset 2px 2px 0 var(--slot-inset), inset -2px -2px 0 color-mix(in srgb, var(--slot) 40%, #fff);
}
.tx-kinds button:hover:not(:disabled) { background: var(--slot-hover); }
.tx-kinds button.on { background: var(--slot-selected); border-color: var(--accent); }
.tx-kinds button:disabled { opacity: .6; cursor: not-allowed; }
.tx-kinds .tx-ico { width: 32px; height: 32px; }
.tx-kinds span { font-size: 13px; font-weight: 700; }
.tx-kinds small { font-size: 11px; color: var(--text-muted); }
#qPrompt, .tx-input, #sInput {
  width: 100%; box-sizing: border-box; resize: vertical; padding: 10px 11px; font-size: 14px; line-height: 1.6;
  color: var(--text); background: var(--surface-sunken); border: 2px solid var(--border-strong); border-radius: 3px;
  box-shadow: inset 2px 2px 0 var(--slot-inset);
}
#qPrompt:focus, .tx-input:focus, #sInput:focus { outline: none; border-color: var(--accent); }
.tx-ideas { display: flex; flex-wrap: wrap; gap: 5px; }
.tx-idea { padding: 4px 9px; font-size: 12px; cursor: pointer; color: var(--text-secondary); background: var(--surface); border: 1px dashed var(--border-strong); border-radius: 3px; }
.tx-idea:hover:not(:disabled) { color: var(--accent); border-color: var(--accent); border-style: solid; }
.tx-ref-add {
  display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 2px 10px; width: 100%; padding: 10px 12px; cursor: pointer; text-align: left;
  background: var(--surface-sunken); border: 2px dashed var(--border-strong); border-radius: 3px;
}
.tx-ref-add:hover:not(:disabled) { border-color: var(--accent); }
.tx-ref-add .tx-ico { grid-row: span 2; width: 28px; height: 28px; }
.tx-ref-add span { font-size: 13px; font-weight: 650; }
.tx-ref-add small { font-size: 11px; color: var(--text-muted); }
.tx-ref-card { display: flex; align-items: center; gap: 10px; padding: 8px; background: var(--accent-soft); border: 2px solid var(--accent-border); border-radius: 3px; }
.tx-ref-card img { width: 48px; height: 48px; object-fit: cover; border-radius: 2px; background: var(--surface); }
.tx-ref-card span { flex: 1; min-width: 0; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-ref-card button { width: 28px; height: 28px; cursor: pointer; font-size: 16px; color: var(--text-secondary); background: var(--surface); border: 1px solid var(--border); border-radius: 2px; }
.tx-price { margin: 0; font-size: 13px; color: var(--text-secondary); }
/* 2026-11-12 换模型：高级生图 / 免费生图 */
.tx-lines { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.tx-line { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 8px 10px; min-width: 0;
  border: 1px solid var(--border); border-radius: var(--radius-sm, 6px); background: transparent; color: var(--text-secondary);
  cursor: pointer; text-align: left; font: inherit; }
.tx-line:hover:not(:disabled) { color: var(--text); border-color: var(--border-hover); }
.tx-line.on { color: var(--text); background: var(--slot-selected); border-color: var(--accent); }
.tx-line:disabled { opacity: .5; cursor: not-allowed; }
.tx-line-name { font-weight: 700; font-size: 14px; }
.tx-line small { font-size: 11px; line-height: 1.35; color: var(--text-secondary); }
.tx-line.is-free.on { border-color: var(--success); }
.tx-line.is-free .tx-line-name::after { content: "免费"; margin-left: 6px; padding: 0 5px; border-radius: 3px; font-size: 10px;
  font-weight: 700; vertical-align: 1px; color: #fff; background: var(--success); }
.tx-price b.good { color: var(--success); }
.tx-price b.bad { color: var(--danger); }
.tx-go { width: 100%; min-height: 46px; font-size: 16px; }
.tx-progress { display: grid; gap: 7px; }
.tx-progress p { margin: 0; font-size: 12px; color: var(--text-secondary); }
.tx-progress b { color: var(--text); }
.tx-note { margin: 0; font-size: 12px; line-height: 1.6; color: var(--text-secondary); }
.tx-note:empty { display: none; }
.tx-note a, .tx-link { color: var(--accent); background: none; border: 0; padding: 0; cursor: pointer; font-size: inherit; text-decoration: underline; }

/* ---------------------------------------------------------------- 智能创作 */
.tx-smart { display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: 12px; padding: 12px; }
.tx-sessions { display: flex; flex-direction: column; gap: 8px; padding: 10px; min-height: 0; }
.tx-sessions > header { display: flex; align-items: center; gap: 6px; }
.tx-sessions > header b { flex: 1; }
.tx-icon-btn.tx-icon-sm { width: 28px; height: 28px; }
.tx-smart.list-closed { grid-template-columns: minmax(0, 1fr); }
.tx-smart.list-closed .tx-sessions { display: none; }
.tx-scrim { display: none; }
.tx-search { width: 100%; box-sizing: border-box; padding: 7px 10px; font-size: 13px; background: var(--surface-sunken); border: 2px solid var(--border); border-radius: 3px; }
.tx-search:focus { outline: none; border-color: var(--accent); }
.tx-session-list { flex: 1; min-height: 0; overflow-y: auto; display: grid; align-content: start; gap: 4px; }
.tx-session { position: relative; display: flex; align-items: center; gap: 9px; width: 100%; padding: 7px; cursor: pointer; text-align: left; background: transparent; border: 2px solid transparent; border-radius: 3px; }
.tx-session:hover { background: var(--surface-hover); }
.tx-session.on { background: var(--slot-selected); border-color: var(--accent); }
.tx-session-thumb { width: 40px; height: 40px; flex: none; display: grid; place-items: center; background: var(--slot); border: 2px solid var(--slot-border); border-radius: 2px; overflow: hidden; }
.tx-session-thumb img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }
.tx-session-thumb .px { width: 24px; height: 24px; opacity: .7; }
.tx-session-text { display: grid; gap: 3px; min-width: 0; }
.tx-session-text b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-session-text small { font-size: 11px; color: var(--text-muted); }
.tx-pulse { position: absolute; right: 8px; top: 8px; width: 8px; height: 8px; background: var(--accent); animation: tx-blink 1s steps(2) infinite; }
@keyframes tx-blink { 50% { opacity: .2; } }
.tx-foot { margin: 0; font-size: 11px; color: var(--text-muted); text-align: center; padding: 6px; }
.tx-foot:empty { display: none; }
.tx-smart-main { display: flex; flex-direction: column; gap: 10px; min-width: 0; min-height: 0; }
.tx-smart-head { display: flex; align-items: center; gap: 8px; min-height: 34px; }
#sTitle { font-size: 16px; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#sTitle.editable { cursor: pointer; border-bottom: 1px dashed transparent; }
#sTitle.editable:hover { border-bottom-color: var(--text-muted); }
.tx-chip { font-size: 11px; padding: 3px 7px; color: var(--text-secondary); background: var(--surface-sunken); border: 1px solid var(--border); border-radius: 2px; }
.tx-chip:empty { display: none; }
.tx-chip.busy { color: var(--accent); border-color: var(--accent-border); background: var(--accent-soft); }
.tx-chip.bad { color: var(--danger); border-color: var(--danger-border); background: var(--danger-soft); }
.tx-only-narrow { display: none; }
.tx-smart-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 372px; gap: 12px; }
.tx-chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; }
.tx-feed { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 12px; }
.tx-hello { padding: 14px; color: var(--text-secondary); font-size: 13px; line-height: 1.7; background: var(--surface-sunken); border: 2px dashed var(--border); border-radius: 3px; }
.tx-hello b { display: block; color: var(--text); font-size: 14px; margin-bottom: 4px; }
.tx-hello p { margin: 0; }
.tx-bubble { max-width: 92%; padding: 8px 11px; font-size: 13px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; border: 2px solid var(--border); border-radius: 3px; background: var(--surface); }
.tx-bubble.user { align-self: flex-end; background: var(--accent-soft); border-color: var(--accent-border); }
.tx-bubble.assistant { align-self: flex-start; }
.tx-bubble.error { align-self: stretch; color: var(--danger); background: var(--danger-soft); border-color: var(--danger-border); }
.tx-bubble.folded { max-height: 8.5em; overflow: hidden; -webkit-mask: linear-gradient(#000 70%, transparent); mask: linear-gradient(#000 70%, transparent); }
.tx-working { display: flex; align-items: center; gap: 8px; padding: 8px 10px; font-size: 13px; color: var(--accent); background: var(--accent-soft); border: 2px solid var(--accent-border); border-radius: 3px; }
.tx-process { flex: none; border-top: 2px solid var(--border); font-size: 12px; color: var(--text-muted); }
.tx-process summary { cursor: pointer; padding: 7px 12px; }
.tx-process #sSteps { max-height: 160px; overflow-y: auto; padding: 0 12px 8px; }
.tx-step { padding: 3px 0; border-bottom: 1px dotted var(--border); overflow-wrap: anywhere; }
.tx-chat-form { flex: none; display: grid; grid-template-columns: minmax(0, 1fr); gap: 7px; padding: 10px; border-top: 2px solid var(--border); background: var(--surface-alt); }
#sInput { min-height: 64px; max-height: 200px; resize: vertical; }
.tx-chat-bar { display: flex; align-items: center; gap: 8px; }
.tx-chat-hint { flex: 1; min-width: 0; font-size: 11px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-attach { cursor: pointer; }
.tx-chat-refs { display: flex; gap: 6px; flex-wrap: wrap; }
.tx-ref-chip { position: relative; width: 48px; height: 48px; border: 2px solid var(--border-strong); border-radius: 2px; overflow: hidden; background: var(--surface); }
.tx-ref-chip img { width: 100%; height: 100%; object-fit: cover; }
.tx-ref-chip button { position: absolute; right: 0; top: 0; width: 18px; height: 18px; padding: 0; font-size: 12px; line-height: 1; cursor: pointer; color: #fff; background: rgba(0, 0, 0, .6); border: 0; }

/* ---------------------------------------------------------------- 贴图库 */
.tx-library { display: flex; flex-direction: column; gap: 10px; padding: 12px 14px 0; overflow-y: auto; }
.tx-lib-tools { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 9px 10px; }
.tx-lib-tools .tx-search { width: 240px; }
.tx-filters { display: flex; flex-wrap: wrap; gap: 4px; }
.tx-chip-btn { min-height: 28px; padding: 0 10px; font-size: 12px; font-weight: 600; cursor: pointer; color: var(--text-secondary); background: var(--surface-sunken); border: 2px solid var(--border); border-radius: 2px; }
.tx-chip-btn:hover { color: var(--text); }
.tx-chip-btn.on { color: var(--text); background: var(--slot-selected); border-color: var(--accent); }
.tx-lib-total { font-size: 12px; color: var(--text-muted); }
.tx-hint { display: grid; gap: 4px; margin: 6px 0 0; padding: 7px 10px; font-size: 12px; line-height: 1.6; color: var(--warn); background: var(--warn-soft); border: 2px solid var(--warn-border); border-radius: 3px; }
.tx-hint[hidden] { display: none; }
.tx-lib-note { margin: 0; padding: 8px 12px; font-size: 13px; color: var(--warn); background: var(--warn-soft); border: 2px solid var(--warn-border); border-radius: 3px; }
.tx-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(156px, 1fr)); gap: 10px; }
.tx-card { display: flex; flex-direction: column; gap: 6px; padding: 7px; background: var(--surface); border: 2px solid var(--border); border-radius: 3px; }
.tx-card:hover { border-color: var(--border-hover); }
.tx-card-slot { aspect-ratio: 1; width: 100%; box-sizing: border-box; }
.tx-card-meta { display: grid; gap: 2px; min-width: 0; }
.tx-card-meta b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-card-meta small { font-size: 11px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-card-actions { display: flex; gap: 5px; }
/* 2026-11-03 贴图库：排序、多选 */
.tx-sort { padding: 5px 8px; font: inherit; font-size: 12px; color: var(--text); background: var(--surface-sunken); border: 2px solid var(--border); border-radius: 3px; }
.tx-card-slot { position: relative; }
.tx-pick-mark { display: none; position: absolute; top: 6px; left: 6px; width: 20px; height: 20px; box-sizing: border-box; border: 2px solid var(--border-hover); border-radius: 3px; background: var(--surface); }
.tx-grid.is-picking .tx-pick-mark { display: block; }
.tx-card.is-picked { border-color: var(--accent); }
.tx-card.is-picked .tx-pick-mark { background: var(--accent); border-color: var(--accent); }
.tx-card.is-picked .tx-pick-mark::after { content: ''; position: absolute; left: 5px; top: 1px; width: 5px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.tx-grid.is-picking .tx-card-actions { visibility: hidden; }
.tx-pick-bar { position: sticky; bottom: 8px; z-index: 3; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 10px; padding: 9px 12px; box-shadow: 0 4px 16px rgba(0, 0, 0, .18); }
.tx-pick-bar b { font-size: 13px; }
.tx-card-actions .txb:first-child { flex: 1; }
.tx-lib-more { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 16px 0 26px; font-size: 13px; color: var(--text-muted); }
.tx-empty-lib { grid-column: 1 / -1; margin: 30px auto; }

/* ---------------------------------------------------------------- 弹窗 / 菜单 / 提示 */
.tx-dialog { width: min(520px, calc(100vw - 24px)); max-height: calc(100dvh - 40px); padding: 0; color: var(--text); overflow: auto; }
.tx-dialog.wide { width: min(900px, calc(100vw - 24px)); }
.tx-dialog::backdrop { background: var(--overlay); }
.tx-dialog > header { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 2px solid var(--border); }
.tx-dialog > header h2 { flex: 1; margin: 0; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-x { width: 30px; height: 30px; cursor: pointer; font-size: 18px; color: var(--text-secondary); background: transparent; border: 2px solid var(--border); border-radius: 2px; }
.tx-dialog-text { margin: 0; padding: 14px 16px; font-size: 14px; line-height: 1.7; color: var(--text-secondary); }
.tx-dialog > .tx-input, .tx-dialog > .tx-feedback { margin: 14px 16px; width: calc(100% - 32px); }
.tx-feedback .tx-input { width: 100%; }
.tx-dialog > footer { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; padding: 12px 16px; border-top: 2px solid var(--border); background: var(--surface-alt); }
.tx-detail { display: grid; grid-template-columns: minmax(0, 1fr) 260px; grid-template-rows: auto auto; }
.tx-detail-canvas { height: min(56vh, 480px); grid-column: 1; }
.tx-detail > .tx-stage-bar { grid-column: 1; grid-row: 2; }
.tx-detail-info { grid-column: 2; grid-row: 1 / span 2; display: grid; align-content: start; gap: 9px; padding: 14px; font-size: 13px; border-left: 2px solid var(--border); }
.tx-detail-info div { display: grid; gap: 2px; }
.tx-detail-info span { font-size: 11px; color: var(--text-muted); }
.tx-detail-prompt { margin: 4px 0 0; padding: 9px; line-height: 1.65; color: var(--text-secondary); background: var(--surface-sunken); border: 1px solid var(--border); border-radius: 2px; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 220px; overflow-y: auto; user-select: text; }
.tx-menu { position: fixed; z-index: 30; display: grid; min-width: 170px; padding: 5px; }
.tx-menu button { padding: 8px 10px; font-size: 13px; text-align: left; cursor: pointer; color: inherit; background: transparent; border: 0; border-radius: 2px; }
.tx-menu button:hover { background: #ffffff1f; }
.tx-menu button.danger { color: #ff9c8f; }
.tx-toast { position: fixed; left: 50%; bottom: 26px; z-index: 40; transform: translateX(-50%); max-width: min(560px, calc(100vw - 32px)); padding: 10px 16px; font-size: 13px; line-height: 1.6; text-align: center; }
.tx-toast.bad { box-shadow: inset 0 0 0 2px #a8322a, 0 8px 24px rgba(0, 0, 0, .35); }

/* ---------------------------------------------------------------- 窄屏 */
@media (min-width: 981px) {
  .tx-smart:not(.list-closed) #sListToggle { display: none; }
}
@media (max-width: 1180px) {
  .tx-smart { grid-template-columns: 204px minmax(0, 1fr); }
  .tx-smart-body { grid-template-columns: minmax(0, 1fr) 320px; }
}
/* 再窄就把创作记录收成抽屉：点「☰ 记录」拉出来，点 ×、点旁边空白或按 Esc 收回去 */
@media (max-width: 980px) {
  .tx-smart, .tx-smart.list-closed { grid-template-columns: minmax(0, 1fr); }
  .tx-smart .tx-sessions, .tx-smart.list-closed .tx-sessions { display: flex; position: absolute; z-index: 6; left: 12px; top: 12px; bottom: 12px; width: 270px; transform: translateX(calc(-100% - 24px)); visibility: hidden; transition: transform .2s, visibility 0s .2s; box-shadow: 0 12px 40px rgba(0, 0, 0, .35); }
  .tx-smart.list-open .tx-sessions { transform: none; visibility: visible; transition: transform .2s; }
  .tx-smart.list-open .tx-scrim { display: block; position: absolute; inset: 0; z-index: 5; background: rgba(0, 0, 0, .35); }
}
@media (max-width: 960px) {
  .tx-quick { grid-template-columns: minmax(0, 1fr) 320px; }
  .tx-tabs button { padding: 0 9px; }
  .tx-balance { display: none; }
}
@media (max-width: 820px) {
  .tx-top { flex-wrap: wrap; gap: 6px 8px; padding: 6px 10px; }
  .tx-brand b { font-size: 14px; }
  .tx-tabs { order: 5; flex: 1 0 100%; margin: 0; }
  .tx-tabs button { flex: 1; justify-content: center; min-height: 40px; font-size: 13px; padding: 0 4px; gap: 4px; }
  .tx-view { overflow-y: auto; }
  .tx-quick { display: flex; flex-direction: column; padding: 10px; gap: 10px; }
  .tx-quick .tx-stage-col { flex: none; }
  .tx-quick .tx-stage { flex: none; height: 46dvh; min-height: 260px; }
  .tx-compose { overflow: visible; }
  #qPrompt, #sInput, .tx-search, .tx-input { font-size: 16px; }
  .tx-smart { display: flex; flex-direction: column; padding: 10px; }
  .tx-smart .tx-sessions, .tx-smart.list-closed .tx-sessions { left: 10px; top: 10px; bottom: 10px; width: min(300px, calc(100vw - 40px)); }
  #sNewTop { padding: 0 8px; }
  .tx-smart-body { display: flex; flex-direction: column; }
  .tx-smart-body .tx-stage-col { flex: none; }
  .tx-smart-body .tx-stage { flex: none; height: 40dvh; min-height: 230px; }
  .tx-chat { min-height: 360px; }
  .tx-library { padding: 10px 10px 0; }
  .tx-lib-tools .tx-search { width: 100%; }
  .tx-grid { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
  .tx-detail { grid-template-columns: minmax(0, 1fr); }
  .tx-detail-info { grid-column: 1; grid-row: auto; border-left: 0; border-top: 2px solid var(--border); }
  .tx-detail-canvas { height: 42dvh; }
}
@media (prefers-reduced-motion: reduce) {
  .tx-empty-art .px, .tx-spin, .tx-pulse { animation: none; }
  .tx-xp i { transition: none; }
}

/* 2026-11-13 站长：「贴图页面的这些 ui 都拿网站的 gpt 生图 ai 生一遍，做好看一点」。
   图标用站里的生图（GPT i 2.5）按「MC 物品」提示词重画，128px 原图缩小显示（不再是 16×16 放大）；
   顶栏下面那条草边换成画出来的草方块侧面。回滚：删掉这一段即可，上面原来的 16×16 图都还在。 */
:root {
  --px-sword: url(/assets/tx-ui/sword.png?v=20261113ui1);
  --px-grass: url(/assets/tx-ui/grass.png?v=20261113ui1);
  --px-potion: url(/assets/tx-ui/potion.png?v=20261113ui1);
  --px-paint: url(/assets/tx-ui/paint.png?v=20261113ui1);
  --px-bolt: url(/assets/tx-ui/bolt.png?v=20261113ui1);
  --px-star: url(/assets/tx-ui/star.png?v=20261113ui1);
  --px-chest: url(/assets/tx-ui/chest.png?v=20261113ui1);
  --px-image: url(/assets/tx-ui/image.png?v=20261113ui1);
}
.tx-ico, .px, .tx-logo { image-rendering: auto; }
.tx-logo { width: 30px; height: 30px; }
.tx-tabs .tx-ico { width: 22px; height: 22px; }
.tx-kinds .tx-ico { width: 40px; height: 40px; }
.tx-ref-add .tx-ico { width: 32px; height: 32px; }
.tx-empty-art .px { width: 76px; height: 76px; }
.tx-session-thumb .px { width: 26px; height: 26px; }
.tx-top::after {
  height: 10px; background: url(/assets/tx-ui/grass-strip.png?v=20261113ui1) repeat-x 0 0 / 32px 10px;
  image-rendering: pixelated; -webkit-mask: none; mask: none;
}

/* 微信 / QQ 内置浏览器里「下载」改成长按保存（2026-11-17） */
.tx-save .tx-save-img { display: grid; place-items: center; margin: 14px 16px 0; padding: 12px; min-height: 160px; border: 2px solid var(--border); border-radius: 2px;
  background-color: var(--checker-b);
  background-image: linear-gradient(45deg, var(--checker-a) 25%, transparent 25%), linear-gradient(-45deg, var(--checker-a) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--checker-a) 75%), linear-gradient(-45deg, transparent 75%, var(--checker-a) 75%);
  background-size: 16px 16px; background-position: 0 0, 0 8px, 8px -8px, -8px 0; }
.tx-save .tx-save-img img { display: block; max-width: 100%; max-height: min(52vh, 420px); object-fit: contain;
  -webkit-touch-callout: default; -webkit-user-select: auto; user-select: auto; pointer-events: auto; }
.tx-save .tx-save-img.tiny img { width: 192px; height: 192px; image-rendering: pixelated; image-rendering: crisp-edges; }
