:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --ink: #17191f;
  --muted: #6d7280;
  --line: #dfe2e7;
  --soft: #f7f8fa;
  --accent: #c92fd0;
  --accent-dark: #9e20a5;
  --accent-soft: #fff0ff;
  --success: #14835b;
  --shadow: 0 10px 28px rgba(24, 27, 38, 0.06);
}

* { box-sizing: border-box; }
html { min-width: 320px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
}
button, input, select { font: inherit; letter-spacing: 0; }
button, select { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid rgba(201, 47, 208, 0.18); outline-offset: 2px; }

.shell { width: min(1240px, 100%); margin: 0 auto; padding: 24px 28px 36px; }
.topbar { min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.brand { display: inline-flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; min-width: 0; }
.brand-mark { width: 44px; height: 44px; flex: 0 0 44px; overflow: hidden; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.brand-mark img { width: 56px; height: 56px; object-fit: cover; }
.brand strong { display: block; font-size: 18px; line-height: 1.25; }
.brand small { display: block; color: var(--muted); font-size: 11px; }
.top-status { display: flex; align-items: center; gap: 8px; }
.service-status, .format-status { min-height: 34px; display: inline-flex; align-items: center; gap: 7px; padding: 0 10px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--muted); font-size: 12px; white-space: nowrap; }
.service-status b { font-weight: 500; }
.service-status i { width: 7px; height: 7px; border-radius: 50%; background: var(--success); }
.service-status.offline i { background: #c88430; }

.search-panel, .results-panel, .inspector { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); }
.search-panel { padding: 28px 32px 24px; margin-bottom: 16px; }
.eyebrow { color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: 1px; }
.search-panel h1 { margin: 6px 0 1px; font-size: 28px; line-height: 1.25; letter-spacing: 0; }
.search-panel > p { margin: 0 0 18px; color: var(--muted); font-size: 13px; }
.searchbar { width: min(760px, 100%); height: 52px; display: flex; align-items: center; gap: 8px; padding: 5px 6px 5px 14px; border: 1px solid #ced2d9; border-radius: 8px; background: #fff; }
.searchbar:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(201, 47, 208, 0.1); }
.searchbar input { min-width: 0; flex: 1; height: 100%; padding: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 15px; }
.searchbar input::-webkit-search-cancel-button { cursor: pointer; }
.searchbar input::placeholder { color: #9a9faa; }
.searchbar button { height: 40px; padding: 0 19px; border: 0; border-radius: 7px; background: var(--accent); color: #fff; font-weight: 700; }
.searchbar button:hover { background: var(--accent-dark); }
.quick-list, .recent-list { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin-top: 11px; }
.quick-list > span, .recent-list > span { color: var(--muted); font-size: 11px; }
.quick-list button, .recent-list button { min-height: 30px; padding: 4px 9px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: #535966; }
.quick-list button:hover, .recent-list button:hover { border-color: #d598d8; background: #fff9ff; color: var(--accent-dark); }
.recent-list:empty { display: none; }

.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 16px; align-items: start; }
.results-panel { min-width: 0; padding: 18px; }
.panel-head, .inspector-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel-head { min-height: 38px; margin-bottom: 13px; }
.panel-head h2, .inspector-head h2 { margin: 0; font-size: 14px; }
.panel-head h2 span { color: var(--accent); }
.sort-control { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; }
.sort-control select { height: 36px; padding: 0 9px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: #565c69; }
.result-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.result-card { min-width: 0; padding: 11px; position: relative; border: 1px solid var(--line); border-radius: 8px; background: #fff; text-align: left; transition: border-color 0.16s, box-shadow 0.16s, transform 0.16s; }
.result-card:hover { border-color: #c7cbd3; box-shadow: 0 7px 18px rgba(25, 28, 40, 0.07); transform: translateY(-1px); }
.result-card.active { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(201, 47, 208, 0.1); }
.asset-label { position: absolute; z-index: 1; top: 8px; right: 8px; padding: 3px 6px; border-radius: 5px; background: #edf1f3; color: #53606b; font-size: 10px; }
.result-card.active .asset-label { background: var(--accent-soft); color: var(--accent-dark); }
.icon-tile { width: 100%; aspect-ratio: 1; display: grid; place-items: center; border-radius: 7px; background: var(--soft); overflow: hidden; }
.icon-tile img { width: 58%; height: 58%; object-fit: contain; filter: drop-shadow(0 5px 7px rgba(24, 26, 35, 0.14)); }
.image-fallback { width: 58%; aspect-ratio: 1; display: grid; place-items: center; border-radius: 8px; background: #e9ebef; color: #666c78; font-size: 22px; font-weight: 800; }
.card-title { display: block; margin: 9px 0 3px; overflow: hidden; color: var(--ink); font-size: 13px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.card-meta { display: flex; align-items: center; justify-content: space-between; gap: 7px; min-width: 0; color: var(--muted); font-size: 10px; }
.card-meta span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.loading-state, .empty-state { grid-column: 1 / -1; min-height: 180px; display: grid; place-items: center; padding: 28px 15px; border: 1px dashed #cfd3da; border-radius: 8px; color: var(--muted); text-align: center; }
.loading-state i { width: 24px; height: 24px; display: block; margin: 0 auto 10px; border: 2px solid #eee0ef; border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
.empty-state strong { display: block; margin-bottom: 4px; color: #505562; }
@keyframes spin { to { transform: rotate(360deg); } }

.inspector { position: sticky; top: 16px; padding: 18px; }
.inspector-head > span { max-width: 160px; overflow: hidden; padding: 3px 6px; border: 1px solid var(--line); border-radius: 5px; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.preview { width: 100%; aspect-ratio: 1; display: grid; place-items: center; margin-top: 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--soft); overflow: hidden; }
.preview img { width: 56%; height: 56%; object-fit: contain; filter: drop-shadow(0 8px 10px rgba(24, 26, 35, 0.13)); }
.preview-empty { color: #a3a7b0; font-size: 28px; font-weight: 700; }
.selection { min-height: 62px; padding: 12px 1px 4px; }
.selection strong { display: block; overflow-wrap: anywhere; font-size: 17px; }
.selection span { display: block; color: var(--muted); font-size: 12px; }
.divider { height: 1px; margin: 13px 0; background: var(--line); }
.size-fieldset { margin: 0; padding: 0; border: 0; }
.size-fieldset legend { margin-bottom: 8px; padding: 0; color: var(--muted); font-size: 11px; }
.size-options { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.size-options button { height: 36px; padding: 0 2px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: #5d6370; font-size: 11px; }
.size-options button.selected { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-dark); font-weight: 700; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.actions button, .copy-button { min-height: 42px; border: 0; border-radius: 7px; font-weight: 700; }
.actions .primary { background: var(--success); color: #fff; }
.actions .secondary, .copy-button { background: #eceef1; color: #555b67; }
.copy-button { width: 100%; margin-top: 8px; }
.actions button:disabled, .copy-button:disabled { cursor: not-allowed; background: #e3e5e9; color: #9a9da5; }
footer { padding: 20px 0 0; color: #92969f; font-size: 11px; text-align: center; }
.toast { max-width: calc(100vw - 24px); position: fixed; z-index: 20; bottom: 24px; left: 50%; padding: 9px 13px; border-radius: 7px; background: #202126; color: #fff; font-size: 12px; opacity: 0; pointer-events: none; transform: translate(-50%, 18px); transition: 0.2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1040px) {
  .result-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 840px) {
  .workspace { grid-template-columns: 1fr; }
  .inspector { position: static; }
  .preview { max-width: 320px; margin-right: auto; margin-left: auto; }
}
@media (max-width: 620px) {
  .shell { padding: 16px 12px 28px; }
  .top-status { display: none; }
  .search-panel { padding: 22px 18px 20px; }
  .search-panel h1 { font-size: 24px; }
  .searchbar button { padding: 0 14px; }
  .results-panel { padding: 13px; }
  .result-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel-head { align-items: flex-start; }
  .sort-control > span { display: none; }
}
@media (max-width: 360px) {
  .brand strong { font-size: 16px; }
  .quick-list { gap: 6px; }
  .quick-list button { padding-right: 7px; padding-left: 7px; }
}
