:root { font-family: Inter, "Microsoft YaHei", sans-serif; color: #182230; background: #f4f6f9; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: #f4f6f9; transition: color .42s ease, background-color .42s ease; }
button, input, select { font: inherit; }
button { cursor: pointer; }
.topbar { min-height: 68px; padding: 0 28px; background: #172033; color: white; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 20px; transition: background-color .42s ease, border-color .42s ease; }
.brand { display: flex; align-items: baseline; gap: 10px; }
.brand-home { color: inherit; text-decoration: none; border: 0; background: transparent; padding: 0; text-align: left; }
.brand h1 { margin: 0; font-size: 20px; }
.brand span { color: #aeb9cc; font-size: 12px; }
.view-tabs { display: flex; align-self: stretch; }
.view-tab { min-width: 72px; border: 0; border-bottom: 3px solid transparent; background: transparent; color: #aeb9cc; }
.view-tab.active { color: white; border-bottom-color: #e4572e; }
.header-actions { display: flex; justify-content: flex-end; align-items: center; gap: 14px; font-size: 12px; color: #d2d9e6; }
.header-actions button { height: 34px; border: 1px solid #526179; border-radius: 5px; padding: 0 12px; background: #26364d; color: white; }
#nightModeBtn { width: 34px; padding: 0; font-size: 18px; }
.app-shell { display: grid; grid-template-columns: 270px minmax(0, 1fr); min-height: calc(100vh - 68px); }
.sidebar { padding: 18px 16px 40px; background: white; border-right: 1px solid #dde3ec; transition: background-color .42s ease, border-color .42s ease; }
  .source-panel { position: relative; z-index: 2; margin-bottom: 14px; padding: 14px; border: 1px solid #cbd3de; border-radius: 7px; background: #e9edf2; box-shadow: 0 5px 14px rgba(34,45,58,.09); }
.source-panel .section-title h2 { font-size: 16px; }
.source-panel .link-btn { color: #586678; }
.pixiv-entry { width: 100%; min-height: 66px; margin-bottom: 8px; padding: 12px 14px; border: 1px solid #008ee6; border-radius: 7px; background: #0096fa; color: white; display: grid; gap: 3px; text-align: left; box-shadow: 0 6px 16px rgba(0,150,250,.16); transition: background-color .25s ease, border-color .25s ease, box-shadow .25s ease, transform .25s ease; }
.pixiv-entry:hover { background: #008be9; transform: translateY(-1px); }
.pixiv-entry.active { background: #0878c9; border-color: #0567ad; box-shadow: 0 8px 20px rgba(0,126,214,.28); }
.pixiv-entry strong { font-size: 23px; line-height: 1; letter-spacing: 0; }
.pixiv-entry span { font-size: 11px; color: rgba(255,255,255,.84); }
.pixiv-login-side { width: 100%; height: 38px; margin-bottom: 14px; border: 1px solid #b8d8ef; border-radius: 6px; background: #f3faff; color: #1575b5; font-size: 12px; font-weight: 600; }
.pixiv-hidden-filter { max-height: 280px; opacity: 1; overflow: hidden; transition: max-height .42s cubic-bezier(.22,.8,.22,1), margin .42s ease, padding .42s ease, opacity .22s ease, transform .42s ease; }
body.pixiv-mode .pixiv-hidden-filter { max-height: 0; margin: 0; padding: 0; border-width: 0; opacity: 0; pointer-events: none; transform: translateY(-8px); }
.pixiv-sidebar-panel { max-height: 0; margin-bottom: 0; opacity: 0; overflow: hidden; pointer-events: none; transform: translateY(-10px); transition: max-height .42s cubic-bezier(.22,.8,.22,1), margin-bottom .42s cubic-bezier(.22,.8,.22,1), opacity .24s ease, transform .42s cubic-bezier(.22,.8,.22,1); }
.pixiv-sidebar-panel.open { max-height: 230px; margin-bottom: 18px; opacity: 1; pointer-events: auto; transform: translateY(0); }
.pixiv-sidebar-sections { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border: 1px solid #cfe6f7; border-radius: 7px; overflow: hidden; background: #f3faff; }
.pixiv-sidebar-sections .pixiv-section { min-height: 38px; padding: 0 8px; border: 0; border-bottom: 1px solid #dbeaf5; color: #58728b; font-size: 12px; white-space: nowrap; }
.pixiv-sidebar-sections .pixiv-section:nth-child(odd) { border-right: 1px solid #dbeaf5; }
.pixiv-sidebar-sections .pixiv-section[data-section="daily_ai"], .pixiv-sidebar-sections .pixiv-section[data-section^="bookmarks_"] { grid-column: 1 / -1; border-right: 0; }
.pixiv-sidebar-sections .pixiv-section:last-child { border-bottom: 0; }
.pixiv-sidebar-sections .pixiv-section.active { background: #e0f3ff; color: #007fda; box-shadow: inset 0 -2px #0096fa; }
.filter-section { padding-bottom: 19px; margin-bottom: 19px; border-bottom: 1px solid #e7ebf1; }
  .filter-section.source-panel { margin-bottom: 14px; padding: 14px; border: 1px solid #cbd3de; }
.filter-section:last-child { border-bottom: 0; }
.filter-section h2 { margin: 0 0 12px; font-size: 14px; }
.section-title { display: flex; align-items: start; justify-content: space-between; }
.section-title div { display: flex; gap: 8px; }
.link-btn { border: 0; padding: 0; background: transparent; color: #2878c8; font-size: 12px; }
.check-row { display: grid; grid-template-columns: 18px 1fr; gap: 9px; align-items: start; padding: 8px 0; cursor: pointer; }
.check-row input { margin: 3px 0 0; width: 16px; height: 16px; accent-color: #e4572e; }
.check-row span { display: grid; gap: 2px; }
.check-row strong { font-size: 13px; }
.check-row small { color: #778196; font-size: 11px; line-height: 1.4; }
.segments { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid #d6dde8; border-radius: 6px; overflow: hidden; }
.segments label { cursor: pointer; }
.segments input { position: absolute; opacity: 0; }
.segments span { height: 34px; display: grid; place-items: center; font-size: 12px; border-right: 1px solid #d6dde8; }
.segments label:last-child span { border-right: 0; }
.segments input:checked + span { background: #26364d; color: white; }
.resolution-options { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.resolution-options label { cursor: pointer; }
.resolution-options input { position: absolute; opacity: 0; }
.resolution-options span { height: 34px; display: grid; place-items: center; border: 1px solid #d6dde8; border-radius: 5px; font-size: 12px; }
.resolution-options input:checked + span { border-color: #e4572e; color: #d94720; background: #fff4ef; }
.library-filter { display: grid; gap: 8px; }
.library-filter select, .wide-btn { width: 100%; height: 36px; border: 1px solid #d6dde8; border-radius: 5px; background: white; padding: 0 9px; }
.content { min-width: 0; padding: 20px 24px 48px; transition: background-color .42s ease; }
.searchbar { display: grid; grid-template-columns: minmax(260px, 1fr) auto auto; gap: 9px; padding: 13px; background: white; border: 1px solid #dfe5ed; border-radius: 7px; }
.searchbar input, .searchbar button { height: 42px; border-radius: 5px; }
#query { border: 1px solid #ccd5e2; padding: 0 13px; }
.search-btn, .collect-btn { padding: 0 18px; border: 0; font-weight: 600; }
.search-btn { background: #26364d; color: white; }
.collect-btn { background: #e4572e; color: white; }
button:disabled { opacity: .55; cursor: wait; }
.result-head { min-height: 48px; display: flex; align-items: center; }
.notice { margin: 0; color: #687386; font-size: 13px; }
.notice.error { color: #c0392b; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.card { position: relative; background: white; border: 1px solid #dfe5ed; border-radius: 7px; overflow: hidden; }
.favorite { position: absolute; z-index: 2; top: 8px; right: 8px; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 50%; background: rgba(255,255,255,.9); color: #536077; font-size: 22px; line-height: 1; }
.favorite.active { color: #e4572e; }
.thumb { position: relative; width: 100%; padding: 0; border: 0; background: #edf1f6; aspect-ratio: 2 / 3; display: grid; place-items: center; }
.thumb-open { width: 100%; height: 100%; padding: 0; border: 0; background: transparent; display: grid; place-items: center; }
.thumb img { width: 100%; height: 100%; object-fit: contain; }
.thumb img { opacity: 0; transition: opacity .28s ease; }
.thumb img.loaded { opacity: 1; }
.page-count { position: absolute; z-index: 2; left: 10px; bottom: 10px; min-width: 25px; height: 25px; padding: 0 7px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.68); border-radius: 6px; background: rgba(20,29,40,.7); color: white; font-size: 12px; font-weight: 700; line-height: 1; pointer-events: none; }
.card-enter { animation: card-enter .28s ease both; }
@keyframes card-enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.skeleton-card { pointer-events: none; }
.skeleton-image { aspect-ratio: 2 / 3; background: #e7ebf1; }
.skeleton-body { display: grid; gap: 9px; padding: 13px; }
.skeleton-body i { display: block; height: 10px; border-radius: 3px; background: #e7ebf1; }
.skeleton-body i:nth-child(1) { width: 72%; }
.skeleton-body i:nth-child(2) { width: 92%; }
.skeleton-body i:nth-child(3) { width: 54%; }
.skeleton-image, .skeleton-body i { background-image: linear-gradient(90deg, #e7ebf1 20%, #f5f7fa 42%, #e7ebf1 64%); background-size: 220% 100%; animation: skeleton 1.25s linear infinite; }
@keyframes skeleton { to { background-position-x: -220%; } }
.card-body { position: relative; padding: 11px 11px 58px; }
.card h3 { margin: 0 0 6px; font-size: 14px; line-height: 1.35; overflow-wrap: anywhere; }
.meta, .tags { color: #687386; font-size: 11px; line-height: 1.45; margin: 5px 0; }
.tags { min-height: 32px; max-height: 48px; display: flex; flex-wrap: wrap; align-content: flex-start; gap: 4px; overflow: hidden; }
.tag-chip { max-width: 100%; min-height: 21px; padding: 2px 6px; border: 0; border-radius: 4px; background: #eef3f8; color: #4a647e; font-size: 10px; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: color .18s ease, background-color .18s ease; }
.tag-chip:hover { background: #dceeff; color: #0878c9; }
.badge { display: inline-block; width: fit-content; padding: 3px 7px; border-radius: 4px; font-size: 10px; margin-bottom: 7px; }
.badge.official { background: #e7f6ed; color: #18794e; }
.badge.pixiv { background: #e9f5ff; color: #1670ad; }
.badge.danbooru { background: #f1f3f7; color: #667085; }
.download-icon { position: absolute; z-index: 2; right: 10px; bottom: 10px; width: 38px; height: 38px; margin: 0; padding: 0; display: grid; place-items: center; border: 1px solid #cbd6e3; border-radius: 8px; background: rgba(255,255,255,.96); color: #536477; opacity: .55; box-shadow: 0 3px 10px rgba(32,48,66,.12); transition: opacity .18s ease, border-color .18s ease, color .18s ease, background-color .18s ease, transform .18s ease; }
.download-icon:hover { border-color: #168eea; color: #168eea; background: #f5fbff; opacity: 1; }
.download-icon:active { transform: translateY(1px); }
.download-icon svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 26px; }
.pagination button { height: 36px; min-width: 82px; border: 1px solid #ccd5e2; border-radius: 5px; background: white; }
.pagination span { font-size: 13px; color: #687386; }
.history-list { display: grid; gap: 8px; }
.history-group { display: grid; gap: 10px; }
.history-group + .history-group { margin-top: 22px; }
.history-group h2 { margin: 0; font-size: 15px; color: #26364d; }
.history-group-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.history-scroll-controls { display: flex; gap: 6px; }
.history-scroll-controls button { width: 34px; height: 32px; padding: 0; border: 1px solid #ccd5e2; border-radius: 5px; background: white; color: #405269; font-size: 22px; line-height: 1; text-align: center; }
.history-grid { display: flex; gap: 10px; padding: 2px 2px 10px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; scrollbar-width: thin; }
.history-item { flex: 0 0 clamp(300px, 34vw, 390px); min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 14px; border: 1px solid #dfe5ed; border-radius: 7px; background: white; scroll-snap-align: start; }
.history-item button { text-align: left; border: 0; background: transparent; }
.history-item strong { display: block; margin-bottom: 4px; }
.history-item small { color: #778196; }
.history-main { width: 100%; min-width: 0; }
.history-preview-strip { width: 100%; height: 190px; display: grid; place-items: center; margin-top: 10px; border-radius: 5px; overflow: hidden; background: #edf1f6; }
.history-preview-strip img { width: 100%; height: 100%; object-fit: contain; }
.history-preview-empty { display: grid; place-items: center; height: 100%; padding: 12px; color: #98a2b3; font-size: 11px; text-align: center; }
dialog { border: 0; padding: 0; box-shadow: 0 24px 80px rgba(20,30,45,.28); }
dialog::backdrop { background: rgba(20,27,38,.68); }
.login-dialog { width: min(460px, calc(100vw - 30px)); border-radius: 8px; }
.account-dialog { width: min(420px, calc(100vw - 32px)); min-height: 224px; border: 1px solid #d9e0e8; border-radius: 8px; overflow: hidden; }
.account-body { display: grid; gap: 14px; }
.account-oidc-login { display: flex; align-items: center; justify-content: center; min-height: 44px; border-radius: 6px; background: #245b60; color: #fff; font-size: 14px; font-weight: 700; text-decoration: none; }
#accountDialog [hidden] { display: none !important; }
.account-intro { margin: 0; color: #475467; font-size: 13px; line-height: 1.7; }
.account-help { margin: 0; color: #667085; font-size: 11px; line-height: 1.6; }
.account-current { display: flex; align-items: center; justify-content: space-between; margin: 0 0 16px; }
.account-current span { color: #667085; font-size: 12px; }
#accountMessage { color: #667085; font-size: 11px; line-height: 1.5; }
#accountMessage:empty { display: none; }
.account-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.account-actions a, .account-actions button { display: flex; align-items: center; justify-content: center; min-width: 0; min-height: 40px; padding: 0 8px; border: 1px solid #ccd5e2; border-radius: 5px; background: white; color: #344054; font-size: 12px; font-weight: 600; line-height: 1.2; text-align: center; text-decoration: none; }
.account-actions .is-danger { color: #b42318; }
.account-actions button:disabled { opacity: .5; cursor: wait; }
#accountMessage:not(:empty) { min-height: 20px; margin: 14px 0 0; color: #667085; font-size: 12px; line-height: 1.6; }
.account-logout-progress { display: inline-flex; align-items: center; gap: 9px; }
.account-logout-spinner { width: 14px; height: 14px; flex: 0 0 14px; border: 2px solid #d0d5dd; border-top-color: #c90061; border-radius: 50%; animation: workbench-account-spin .72s linear infinite; }
@keyframes workbench-account-spin { to { transform: rotate(360deg); } }
body.dark-mode .account-oidc-login { background: #2f747b; }
body.dark-mode .account-intro, body.dark-mode .account-help, body.dark-mode .account-current span, body.dark-mode #accountMessage { color: #a7b2c1; }
body.dark-mode .account-actions a, body.dark-mode .account-actions button { background: #121820; border-color: #3a4554; color: #d7e2ee; }
body.dark-mode .account-actions .is-danger { color: #ffb4ab; }
body.dark-mode .account-dialog { border-color: #303946; }
body.dark-mode #accountMessage:not(:empty) { color: #aeb9c7; }
body.dark-mode .account-logout-spinner { border-color: #465365; border-top-color: #ff6da9; }
.dialog-head { height: 58px; display: flex; align-items: center; justify-content: space-between; padding: 0 18px; border-bottom: 1px solid #e1e6ee; }
.dialog-head h2 { margin: 0; font-size: 17px; }
.dialog-head button, .detail-close { border: 0; background: transparent; font-size: 24px; }
.dialog-body { padding: 18px; }
.account-dialog .dialog-head { min-height: 62px; height: auto; padding: 0 22px; }
.account-dialog .dialog-head h2 { font-size: 20px; line-height: 1.2; }
.account-dialog .dialog-head button { width: 32px; height: 32px; border: 1px solid #d6dce5; border-radius: 50%; font-size: 22px; line-height: 1; }
.account-dialog .dialog-body { padding: 22px; }
.account-dialog .account-intro { min-height: 40px; }
.dialog-body label { display: grid; gap: 7px; font-size: 12px; color: #667085; }
.dialog-body input { height: 42px; border: 1px solid #ccd5e2; border-radius: 5px; padding: 0 10px; }
.dialog-body p { min-height: 20px; color: #687386; font-size: 12px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.dialog-actions button, #detailFavorite { height: 38px; border: 1px solid #ccd5e2; border-radius: 5px; padding: 0 14px; background: white; }
.dialog-actions .primary { background: #168eea; border-color: #168eea; color: white; }
.detail-dialog { width: min(1280px, calc(100vw - 28px)); height: min(840px, calc(100vh - 28px)); background: #f5f5f6; }
.detail-close { position: absolute; z-index: 4; top: 10px; right: 14px; width: 38px; height: 38px; border-radius: 50%; background: rgba(255,255,255,.92); }
.detail-fullscreen { position: absolute; z-index: 4; top: 10px; right: 60px; width: 38px; height: 38px; padding: 0; border: 0; border-radius: 50%; background: rgba(255,255,255,.92); color: #26364d; font-size: 21px; line-height: 1; }
.detail-nav { display: none; position: absolute; z-index: 4; top: 50%; width: 46px; height: 76px; margin-top: -38px; border: 1px solid rgba(255,255,255,.2); border-radius: 23px; background: rgba(22,29,40,.72); color: #f4f8fc; font-size: 48px; font-family: Arial, sans-serif; font-weight: 300; line-height: 58px; cursor: pointer; }
.detail-prev { left: 18px; }
.detail-next { right: 18px; }
.detail-dialog:fullscreen { width: 100vw; height: 100vh; max-width: none; max-height: none; border-radius: 0; }
.detail-dialog.fullscreen-mode { position: fixed; inset: 0; width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; border-radius: 0; z-index: 1000; }
.detail-dialog.fullscreen-mode::backdrop { background: #000; }
body.detail-fullscreen-open { overflow: hidden; }
html.detail-fullscreen-open { overflow: hidden; }

/* Standalone workspace landing page */
.home-page { min-height: 100vh; background: #eef1f5; color: #182230; }
.home-topbar { min-height: 76px; padding: 0 42px; display: flex; align-items: center; justify-content: space-between; background: #172033; color: white; }
.home-brand { display: flex; align-items: center; gap: 12px; }
.home-brand h1 { margin: 0; font-size: 20px; letter-spacing: .02em; }
.home-brand p { margin: 3px 0 0; color: #aeb9cc; font-size: 11px; }
.home-mark { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid #d7a25b; color: #f3c77d; font-size: 12px; font-weight: 800; letter-spacing: .08em; }
.home-actions { display: flex; align-items: center; gap: 12px; }
.home-actions button, .home-actions a { height: 34px; border: 1px solid #526179; border-radius: 5px; background: #26364d; color: white; text-decoration: none; padding: 0 12px; display: inline-flex; align-items: center; }
.home-actions button { width: 34px; justify-content: center; padding: 0; font-size: 18px; }
.home-actions .home-account-link { background: #c90061; border-color: #c90061; }
.home-main { width: min(1240px, calc(100vw - 64px)); margin: 0 auto; padding: 74px 0 56px; }
.home-intro { max-width: 660px; margin-bottom: 42px; }
.workspace-kicker { margin: 0 0 12px; color: #a46a28; font-size: 11px; font-weight: 800; letter-spacing: .16em; }
.home-intro h2 { margin: 0; color: #1c2737; font-size: clamp(30px, 4vw, 52px); line-height: 1.12; }
.home-intro > p:last-child { margin: 16px 0 0; color: #697689; font-size: 15px; line-height: 1.7; }
.workspace-entries { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; min-height: 390px; }
.workspace-entry { position: relative; min-height: 390px; padding: 34px; border: 0; border-radius: 9px; overflow: hidden; color: white; text-align: left; text-decoration: none; display: flex; flex-direction: column; justify-content: space-between; box-shadow: 0 18px 44px rgba(28,39,55,.16); transition: transform .22s ease, box-shadow .22s ease; }
.workspace-entry:hover { transform: translateY(-5px); box-shadow: 0 24px 54px rgba(28,39,55,.22); }
.workspace-entry::after { content: ''; position: absolute; right: -70px; bottom: -90px; width: 300px; height: 300px; border: 1px solid rgba(255,255,255,.2); transform: rotate(24deg); }
.design-entry { background: #244e57; }
.anime-entry { min-height: 390px; background: #9b6136; }
.entry-index { position: relative; z-index: 1; color: rgba(255,255,255,.64); font-size: 12px; font-weight: 700; letter-spacing: .12em; }
.entry-copy { position: relative; z-index: 1; display: grid; gap: 10px; }
.entry-copy strong { font-size: clamp(30px, 4vw, 58px); line-height: 1; }
.anime-entry .entry-copy strong { font-size: clamp(25px, 3vw, 40px); }
.entry-copy small { color: rgba(255,255,255,.84); font-size: 13px; line-height: 1.5; }
.entry-copy em { color: rgba(255,255,255,.62); font-size: 12px; font-style: normal; }
.entry-arrow { position: relative; z-index: 1; align-self: flex-end; font-size: 42px; line-height: 1; font-weight: 300; }
.design-page { min-height: 100vh; background: #eef1f3; color: #1b2d34; }
.design-topbar { height: 64px; padding: 0 24px; display: flex; align-items: center; gap: 20px; background: #20383d; color: white; }
.design-brand { color: white; text-decoration: none; font-weight: 800; }
.design-topbar > span { color: #aac0c4; font-size: 12px; }
.design-nav { height: 100%; display: flex; align-items: stretch; margin-left: 20px; }
.design-nav a, .design-nav button { min-width: 82px; padding: 0 14px; display: grid; place-items: center; border: 0; border-bottom: 3px solid transparent; background: transparent; color: #b6c7ca; text-decoration: none; font-size: 12px; }
.design-nav .active { color: white; border-bottom-color: #e6a34e; }
.design-night { margin-left: auto; width: 34px; height: 34px; padding: 0; border: 1px solid #557076; border-radius: 5px; background: #2c4a50; color: white; font-size: 18px; }
.design-shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: calc(100vh - 64px); }
.design-sidebar { padding: 20px 16px 40px; background: #fff; border-right: 1px solid #d7dfe2; }
.design-filter-block { padding-bottom: 20px; margin-bottom: 20px; border-bottom: 1px solid #e1e7e9; }
.design-filter-block h2 { margin: 0 0 12px; font-size: 13px; }
.design-filter-title { display: flex; align-items: center; justify-content: space-between; }
.design-filter-title button, .design-library-info button { padding: 0; border: 0; background: transparent; color: #39767c; font-size: 11px; }
.material-source { display: grid; grid-template-columns: 18px 1fr; gap: 9px; padding: 8px 0; cursor: pointer; }
.material-source input { width: 16px; height: 16px; margin: 3px 0 0; accent-color: #39767c; }
.material-source span { min-width: 0; display: grid; gap: 2px; }
.material-source strong { font-size: 12px; }
.material-source small { overflow: hidden; color: #7b898d; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.material-categories { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.material-categories button { height: 32px; padding: 0 7px; border: 1px solid #d4dee0; border-radius: 4px; background: white; color: #53666a; font-size: 11px; }
.material-categories button.active { border-color: #39767c; background: #eaf4f3; color: #245b60; font-weight: 700; }
.design-library-info > div { display: flex; justify-content: space-between; color: #7b898d; font-size: 11px; }
.design-library-info p { margin: 8px 0 0; color: #59696d; font-size: 10px; line-height: 1.5; overflow-wrap: anywhere; }
.design-content { min-width: 0; padding: 20px 24px 48px; }
.material-searchbar { display: grid; grid-template-columns: minmax(220px, 1fr) auto; gap: 8px; padding: 12px; border: 1px solid #d8e0e3; background: white; }
.material-searchbar input { height: 42px; padding: 0 12px; border: 1px solid #cbd7da; border-radius: 4px; }
.material-searchbar button { height: 42px; min-width: 82px; border: 0; border-radius: 4px; background: #2f6970; color: white; font-weight: 700; }
.material-result-head { min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #68787d; font-size: 12px; }
.material-result-head p { margin: 0; }
.material-result-head .error { color: #bf3f32; }
.material-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; align-items: start; }
.material-card { min-width: 0; overflow: hidden; border: 1px solid #d9e1e4; border-radius: 6px; background: white; }
.material-preview { position: relative; width: 100%; aspect-ratio: 4 / 3; padding: 0; display: grid; place-items: center; overflow: hidden; border: 0; background: #e8edef; }
.material-preview img { width: 100%; height: 100%; object-fit: contain; opacity: 0; transition: opacity .2s ease; }
.material-preview img.loaded { opacity: 1; }
.material-preview.file-preview::before { content: 'FILE'; color: #6f8185; font-size: 24px; font-weight: 800; }
.material-file-type { position: absolute; left: 8px; bottom: 8px; padding: 3px 6px; border-radius: 3px; background: rgba(31,47,51,.74); color: white; font-size: 9px; }
.material-card-body { padding: 10px; }
.material-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.material-source-badge { padding: 3px 6px; border-radius: 3px; background: #e6f2f1; color: #28666c; font-size: 9px; }
.material-source-badge.openverse { background: #edf0f7; color: #4e5e84; }
.material-source-badge.wikimedia { background: #eef2ea; color: #526b43; }
.material-source-badge.iconify { background: #f4ece2; color: #8b5c27; }
.material-license { min-width: 0; overflow: hidden; color: #89969a; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.material-card h3 { min-height: 36px; margin: 8px 0 4px; overflow: hidden; font-size: 13px; line-height: 1.35; overflow-wrap: anywhere; }
.material-meta { min-height: 16px; margin: 0; overflow: hidden; color: #748287; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.material-tags { min-height: 40px; max-height: 40px; margin-top: 7px; display: flex; flex-wrap: wrap; align-content: flex-start; gap: 4px; overflow: hidden; }
.material-tags span { padding: 2px 5px; border-radius: 3px; background: #edf3f3; color: #537175; font-size: 9px; }
.material-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 9px; }
.material-actions a { min-width: 52px; height: 30px; padding: 0 9px; display: grid; place-items: center; border: 1px solid #ccd8da; border-radius: 4px; color: #405d62; text-decoration: none; font-size: 10px; }
.material-actions .material-download { border-color: #39767c; background: #39767c; color: white; }
.material-empty { grid-column: 1 / -1; min-height: 240px; display: grid; place-content: center; gap: 6px; color: #849195; text-align: center; }
.material-empty strong { color: #42575b; font-size: 15px; }
.material-skeleton { min-height: 300px; padding: 0 10px 10px; }
.material-skeleton div { height: 170px; margin: 0 -10px 14px; background: #e1e8ea; }
.material-skeleton i { display: block; width: 75%; height: 10px; margin: 8px 0; background: #e1e8ea; }
.material-skeleton i:last-child { width: 52%; }
.material-pagination { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 24px; }
.material-pagination button { height: 34px; min-width: 76px; border: 1px solid #ccd7da; border-radius: 4px; background: white; }
.material-pagination span { color: #69797d; font-size: 12px; }
.material-dialog { width: min(1000px, calc(100vw - 32px)); height: min(760px, calc(100vh - 32px)); grid-template-columns: minmax(0, 1fr) 300px; padding: 0; background: #edf0f1; }
.material-dialog[open] { display: grid; }
.material-dialog > button { position: absolute; z-index: 2; top: 10px; right: 12px; width: 34px; height: 34px; border: 0; border-radius: 50%; background: rgba(255,255,255,.9); font-size: 22px; }
.material-dialog-media { position: relative; min-width: 0; min-height: 0; display: grid; place-items: center; }
.material-dialog-media img { width: 100%; height: 100%; object-fit: contain; padding: 20px; }
.material-dialog-loading, .material-dialog-error { position: absolute; display: none; color: #748287; font-size: 11px; }
.material-dialog.image-loading .material-dialog-loading, .material-dialog.image-error .material-dialog-error { display: block; }
.material-dialog.image-loading .material-dialog-media img, .material-dialog.image-error .material-dialog-media img { opacity: 0; }
.material-dialog > div { padding: 50px 20px 20px; overflow-y: auto; background: white; }
.material-dialog h2 { margin: 8px 0; font-size: 18px; overflow-wrap: anywhere; }
.material-dialog p, .material-dialog span, #materialDialogTags { color: #748287; font-size: 11px; line-height: 1.6; }
.material-dialog a { display: inline-grid; place-items: center; height: 34px; margin-top: 18px; padding: 0 12px; border-radius: 4px; background: #39767c; color: white; text-decoration: none; font-size: 11px; }
body.dark-mode.home-page { background: #111821; color: #eef3f8; }
body.dark-mode .home-intro h2 { color: #eef3f8; }
body.dark-mode .home-intro > p:last-child { color: #a9b6c6; }
body.dark-mode.design-page { background: #111821; color: #eef3f8; }
body.dark-mode .design-sidebar, body.dark-mode .material-searchbar, body.dark-mode .material-card, body.dark-mode .material-dialog > div { background: #1a2029; border-color: #303946; }
body.dark-mode .design-filter-block { border-color: #303946; }
body.dark-mode .material-categories button, body.dark-mode .material-pagination button { background: #222a35; border-color: #3a4554; color: #d4dee8; }
body.dark-mode .material-categories button.active { background: #23484d; border-color: #4f858b; color: white; }
body.dark-mode .material-searchbar input { background: #121820; border-color: #3a4554; color: white; }
body.dark-mode .material-preview, body.dark-mode .material-dialog { background: #111821; }
body.dark-mode .material-card h3, body.dark-mode .material-empty strong, body.dark-mode .material-dialog h2 { color: #edf3f8; }
@media (max-width: 760px) {
  .home-topbar { padding: 0 18px; }
  .home-brand h1 { font-size: 16px; }
  .home-actions a:not(.home-account-link) { display: none; }
  .home-main { width: min(100% - 28px, 620px); padding: 46px 0 32px; }
  .workspace-entries { grid-template-columns: 1fr; min-height: 0; }
  .workspace-entry, .anime-entry { min-height: 260px; padding: 24px; }
  .entry-copy strong, .anime-entry .entry-copy strong { font-size: 34px; }
  .design-topbar { padding: 0 14px; gap: 10px; }
  .design-topbar > span { display: none; }
  .design-nav { margin-left: auto; }
  .design-nav a, .design-nav button { min-width: 58px; padding: 0 7px; }
  .design-nav a:last-child { display: none; }
  .design-night { margin-left: 0; }
  .design-shell { grid-template-columns: 1fr; }
  .design-sidebar { border-right: 0; border-bottom: 1px solid #d7dfe2; padding: 14px; }
  .design-filter-block { margin-bottom: 14px; padding-bottom: 14px; }
  .material-categories { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .design-content { padding: 14px; }
  .material-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .material-card-body { padding: 8px; }
  .material-card h3 { min-height: 32px; font-size: 11px; }
  .material-tags { min-height: 34px; max-height: 34px; }
  .material-dialog[open] { grid-template-columns: 1fr; overflow-y: auto; }
  .material-dialog-media { min-height: 58vh; }
}
.detail-dialog.fullscreen-mode .detail-layout { grid-template-columns: 1fr; background: #090d13; }
.detail-dialog.fullscreen-mode .detail-info { display: none; }
.detail-dialog.fullscreen-mode .detail-media { min-height: 0; padding: 16px; background: #090d13; overflow: hidden; }
.detail-dialog.fullscreen-mode .detail-media > img { max-width: calc(100vw - 32px); max-height: calc(100vh - 32px); box-shadow: 0 18px 60px rgba(0,0,0,.5); }
.detail-dialog.fullscreen-mode .page-strip { display: none; }
.detail-dialog.fullscreen-mode .detail-nav { display: block; }
.detail-dialog.fullscreen-mode .detail-nav:disabled { opacity: .35; cursor: default; }
.detail-dialog.fullscreen-mode .detail-close,
.detail-dialog.fullscreen-mode .detail-fullscreen { background: rgba(22,29,40,.92); color: #f4f8fc; border: 1px solid rgba(255,255,255,.2); }
.detail-layout { height: 100%; display: grid; grid-template-columns: minmax(0, 1fr) 330px; }
.detail-media { position: relative; min-width: 0; padding: 24px; overflow: auto; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.detail-media > img { max-width: 100%; max-height: calc(100% - 88px); object-fit: contain; background: white; }
.detail-page-touch { display: none; }
.page-strip { width: 100%; display: flex; justify-content: center; gap: 8px; overflow-x: auto; }
.page-strip button { flex: 0 0 66px; height: 66px; padding: 0; border: 2px solid transparent; background: white; }
.page-strip button.active { border-color: #168eea; }
.page-strip img { width: 100%; height: 100%; object-fit: cover; }
.detail-info { background: white; padding: 28px 22px; overflow-y: auto; }
.detail-info h2 { margin: 6px 0 10px; font-size: 19px; }
.detail-info > a { color: #1670ad; text-decoration: none; }
.author-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.author-line a { color: #1670ad; text-decoration: none; }
.author-profile-btn { min-height: 29px; padding: 5px 10px; border: 1px solid #b9d9f1; border-radius: 5px; background: #edf8ff; font-size: 12px; font-weight: 600; }
.detail-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.detail-tags .tag-chip { min-height: 28px; padding: 5px 9px; background: #f0f5f9; font-size: 12px; }
.detail-info > p { color: #687386; font-size: 12px; line-height: 1.7; }
.detail-info h3 { margin: 26px 0 10px; font-size: 13px; }
.detail-bookmark { display: flex; gap: 8px; margin-top: 14px; }
.detail-bookmark select { height: 38px; border: 1px solid #ccd5e2; border-radius: 5px; padding: 0 8px; }
.other-works { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.other-works button { padding: 0; border: 0; aspect-ratio: 1; background: #edf1f6; }
.other-works img { width: 100%; height: 100%; object-fit: cover; }
.pixiv-panel { max-height: 0; margin-bottom: 0; border: 0 solid #d7e8f7; border-radius: 7px; background: white; opacity: 0; overflow: hidden; pointer-events: none; transform: translateY(-14px); transform-origin: top center; transition: max-height .46s cubic-bezier(.22,.8,.22,1), margin-bottom .46s cubic-bezier(.22,.8,.22,1), border-width .2s ease, opacity .28s ease, transform .46s cubic-bezier(.22,.8,.22,1), background-color .42s ease; }
.pixiv-panel.open { max-height: 160px; margin-bottom: 14px; border-width: 1px; opacity: 1; pointer-events: auto; transform: translateY(0); }
.pixiv-panel-head { min-height: 76px; display: grid; grid-template-columns: auto minmax(260px, 620px) auto; align-items: center; gap: 22px; padding: 14px 22px; }
.pixiv-panel-head > strong { color: #0096fa; font-size: 29px; letter-spacing: 0; }
#pixivSearchForm { display: grid; grid-template-columns: 1fr auto; }
#pixivSearchForm input { height: 42px; border: 1px solid #cbd9e7; border-right: 0; border-radius: 6px 0 0 6px; padding: 0 12px; }
#pixivSearchForm button { width: 72px; border: 0; border-radius: 0 6px 6px 0; background: #0096fa; color: white; }
.pixiv-search-filters { display: flex; align-items: center; gap: 12px; padding: 0 22px 14px 122px; }
.pixiv-search-filters label { display: flex; align-items: center; gap: 7px; color: #607185; font-size: 12px; }
.pixiv-search-filters select { height: 34px; min-width: 138px; border: 1px solid #cbd9e7; border-radius: 5px; background: white; padding: 0 8px; color: #344054; }
.r18-switch { display: flex; align-items: center; gap: 7px; cursor: pointer; }
.r18-switch input { position: absolute; opacity: 0; }
.r18-switch span { width: 38px; height: 22px; padding: 3px; border-radius: 11px; background: #c7d0dc; transition: background .2s; }
.r18-switch span::after { content: ''; display: block; width: 16px; height: 16px; border-radius: 50%; background: white; transition: transform .2s; }
.r18-switch input:checked + span { background: #f04f68; }
.r18-switch input:checked + span::after { transform: translateX(16px); }
.r18-switch b { font-size: 12px; }
.pixiv-sections { display: flex; gap: 2px; padding: 0 18px; border-top: 1px solid #e5edf5; overflow-x: auto; }
.pixiv-section { height: 46px; padding: 0 16px; border: 0; border-bottom: 3px solid transparent; background: transparent; color: #66768a; white-space: nowrap; }
.pixiv-section.active { color: #0088e8; border-bottom-color: #0096fa; }
.settings-body fieldset { display: grid; gap: 10px; margin: 0 0 18px; padding: 14px; border: 1px solid #dce3ec; border-radius: 6px; }
.settings-body legend { padding: 0 6px; color: #475467; font-size: 13px; }
.settings-body fieldset label { display: flex; grid-template-columns: none; align-items: center; gap: 8px; color: #344054; }
.setting-row { display: flex !important; justify-content: space-between; align-items: center; }
body.pixiv-mode { background: #eaf6ff; }
body.pixiv-mode .topbar { background: #086ca8; }
body.pixiv-mode .sidebar { background: #f7fbff; border-right-color: #cfe6f7; }
body.pixiv-mode .content { background: #eaf6ff; }
body.pixiv-mode .view-tab.active { border-bottom-color: #8ed5ff; }
body.pixiv-mode .filter-section { border-color: #dbeaf5; }
body.pixiv-mode .search-btn, body.pixiv-mode .collect-btn { background: #0096fa; }
body.pixiv-mode .card { border-color: #cce3f4; box-shadow: 0 4px 14px rgba(24,116,177,.06); }
body.pixiv-mode .tag-chip { background: #e7f4fd; color: #2779ad; }
body.pixiv-mode .tag-chip:hover { background: #cfeaff; color: #006fbb; }
body.dark-mode { color: #e5eaf1; background: #11151c; }
body.dark-mode .topbar { background: #0a0e14; }
body.dark-mode.pixiv-mode { background: #0c1721; }
body.dark-mode.pixiv-mode .topbar { background: #063e65; }
body.dark-mode.pixiv-mode .content { background: #0c1721; }
body.dark-mode.pixiv-mode .sidebar { background: #111e29; border-color: #234056; }
body.dark-mode .sidebar, body.dark-mode .searchbar, body.dark-mode .card, body.dark-mode .pixiv-panel, body.dark-mode .detail-info, body.dark-mode .dialog-body, body.dark-mode .dialog-head { background: #1a2029; border-color: #303946; }
body.dark-mode .content, body.dark-mode .detail-dialog, body.dark-mode .detail-media { background: #11151c; }
body.dark-mode input, body.dark-mode select, body.dark-mode .wide-btn, body.dark-mode .download-icon, body.dark-mode .pagination button, body.dark-mode .dialog-actions button, body.dark-mode #detailFavorite { color: #e5eaf1; background: #222a35; border-color: #3a4554; }
body.dark-mode .notice, body.dark-mode .meta, body.dark-mode .tags, body.dark-mode .check-row small, body.dark-mode .detail-info > p { color: #9ca8b8; }
body.dark-mode .filter-section, body.dark-mode .pixiv-sections { border-color: #303946; }
body.dark-mode .thumb, body.dark-mode .other-works button { background: #131923; }
body.dark-mode .pixiv-sidebar-sections { background: #172431; border-color: #28506a; }
body.dark-mode .pixiv-sidebar-sections .pixiv-section { border-color: #28506a; color: #a7bfd2; }
body.dark-mode .pixiv-sidebar-sections .pixiv-section.active { background: #173e59; color: #c9ecff; }
  body.dark-mode .source-panel { background: #252d37; border-color: #465261; box-shadow: none; }
body.dark-mode .pixiv-login-side { background: #19364a; border-color: #285978; color: #a7dafc; }
body.dark-mode .pixiv-search-filters select { background: #222a35; border-color: #3a4554; color: #e5eaf1; }
body.dark-mode .history-group h2 { color: #d8e5f2; }
body.dark-mode .history-item { background: #1a2029; border-color: #303946; }
body.dark-mode .history-scroll-controls button { background: #222a35; border-color: #3a4554; color: #d7e2ee; }
body.dark-mode .history-preview-strip { background: #131923; }
body.dark-mode .tag-chip, body.dark-mode .detail-tags .tag-chip { background: #283341; color: #b5c7da; }
body.dark-mode .tag-chip:hover { background: #174a6c; color: #d7efff; }
body.dark-mode .author-profile-btn { background: #19364a; border-color: #285978; color: #a7dafc; }
@media (max-width: 850px) {
  .account-dialog { width: min(420px, calc(100vw - 40px)); min-height: 246px; }
  .topbar { grid-template-columns: 1fr auto; padding: 14px 16px; }
  .view-tabs { grid-column: 1 / -1; grid-row: 2; height: 44px; }
  .header-actions span { display: none; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { border-right: 0; border-bottom: 1px solid #dde3ec; }
  .content { padding: 14px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .card-body { padding: 8px; }
  .card h3 { font-size: 12px; }
  .favorite { top: 6px; right: 6px; width: 30px; height: 30px; font-size: 19px; }
  .download-icon { right: 8px; bottom: 8px; width: 36px; height: 36px; }
  .page-count { left: 8px; bottom: 8px; min-width: 24px; height: 24px; font-size: 11px; }
  .searchbar { grid-template-columns: 1fr 1fr; }
  #query { grid-column: 1 / -1; }
  .detail-layout { grid-template-columns: 1fr; overflow-y: auto; }
  .detail-media { min-height: 65vh; }
  .detail-dialog.fullscreen-mode.has-multiple-pages .detail-page-touch { display: block; position: absolute; z-index: 3; left: 56px; right: 56px; height: 50%; padding: 0; border: 0; border-radius: 0; background: transparent; color: rgba(255,255,255,.72); touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
  .detail-dialog.fullscreen-mode.has-multiple-pages .detail-page-touch-up { top: 0; }
  .detail-dialog.fullscreen-mode.has-multiple-pages .detail-page-touch-down { bottom: 0; }
  .detail-dialog.fullscreen-mode.has-multiple-pages .detail-page-touch::after { position: absolute; left: 50%; width: 42px; height: 26px; margin-left: -21px; border-radius: 13px; background: rgba(9,13,19,.42); font-size: 24px; line-height: 24px; text-align: center; opacity: .42; }
  .detail-dialog.fullscreen-mode.has-multiple-pages .detail-page-touch-up::after { content: '\2191'; top: 14px; }
  .detail-dialog.fullscreen-mode.has-multiple-pages .detail-page-touch-down::after { content: '\2193'; bottom: 14px; }
  .detail-dialog.fullscreen-mode.has-multiple-pages .detail-page-touch:active::after { background: rgba(22,142,234,.8); opacity: 1; }
  .pixiv-panel-head { grid-template-columns: 1fr; gap: 10px; }
  .pixiv-panel.open { max-height: 290px; }
  .pixiv-sidebar-panel.open { max-height: 240px; }
  .pixiv-search-filters { padding: 0 14px 14px; flex-wrap: wrap; }
  .history-item { flex-basis: min(82vw, 350px); }
}
@media (prefers-reduced-motion: reduce) {
  body, .topbar, .sidebar, .content, .pixiv-panel { transition: none; }
}
