:root {
  color-scheme: light;
  --ink: #11111a;
  --muted: #575667;
  --accent: #3d4a9b;
  --focus: #4e58ae;
  --action: #4b64b4;
  --action-hover: #3a519b;
  --line: #e4e8f1;
  --tint: #edf0ff;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 16px;
  color: var(--ink);
  background: #fff;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  position: relative;
  margin: 0;
  min-width: 270px;
  min-height: 100vh;
  background:
    radial-gradient(ellipse 51% 17rem at 13% 14rem, #bdd6fa 0%, #d6e9fc 42%, #e7f2ff00 100%),
    radial-gradient(ellipse 45% 18rem at 92% 15rem, #e9dff6 0%, #efe6f98a 48%, #f8f4fb00 100%),
    radial-gradient(ellipse 53% 13rem at 45% 3rem, #e8f3ff 0%, #e8f3ff00 100%),
    linear-gradient(180deg, #eef6fd 0%, #f1f7fc 22rem, #fff 37rem);
}
body::before {
  content: ""; position: absolute; inset: 0 0 auto; height: 37rem; pointer-events: none;
  /* Seeded four-tone raster grain keeps the frost irregular at a single-pixel scale. */
  background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABAAgMAAADXB5lNAAAADFBMVEU7SnT///+WstGei8IDZYa4AAAABHRSTlNB2WZsZcC2LwAABEtJREFUeNoBQAS/+wCnGL+zPWzYxIlRir8Kr6L9ALOCUgdRDPXEVw++Q8efOeUA++XTAyjwE0My8aGi9MhE5gB4/dNDw2+MdxUzuTgILZ19AHop0mpj8n2/559BqVdWQ6QAJ2CUN6c4R2gVbp5tNvAAPgAjL1zzu0LxD7Dnv0XKE9dhAEksFKuNCxRvAEczhxK61l8AlpqaG5/5QKtrN7wnXiZPFADuHgkYy9VTY3Pu5sRnOm+OAKsrEDhsCcg9myqv7fu/nCMA1DuWoXLBETvuTNIp0xqBlQBJ27EzAvHBDGj5jK7LwpmFADe+zgKViBsgq76Cp+bWRocAAiPa/Cb9grzfavpKnqCcFwCN5vqZkcIYEBSSNgoxZv0AALf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A+b57Z7s3CH/JCqQk7QAAAAASUVORK5CYII=") repeat;
  background-size: 56px 56px;
  opacity: .16;
  mask-image: radial-gradient(ellipse 61% 21rem at 16% 13rem, #000, #000a 48%, #0000 100%),
    radial-gradient(ellipse 46% 21rem at 90% 14rem, #0008, #0005 45%, #0000 100%);
}
button, input { font: inherit; }
button, .file-button { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; }
h1, h2, h3, p { margin: 0; }

.site-header, .container { position: relative; }
.site-header { border-bottom: 1px solid #ffffff87; }
.header-inner, .container { width: min(1120px, calc(100% - 56px)); margin-inline: auto; }
.header-inner { height: 70px; display: flex; justify-content: space-between; align-items: center; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 760; letter-spacing: -.025em; }
.brand-mark { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 10px; background: var(--action); }
.brand-mark::before { content: ""; width: 13px; height: 13px; border: 1.7px solid white; border-radius: 4.5px; }
.container { padding-block: 64px 72px; }

.page-head { margin-bottom: 34px; }
h1 { font-size: clamp(2.2rem, 5.4vw, 4rem); line-height: 1.14; letter-spacing: -.055em; font-weight: 850; }
#hero-accent { color: var(--accent); }
.page-head p, .gate-content > p { margin-top: 12px; color: var(--muted); line-height: 1.65; }
.workspace-nav { display: flex; align-items: center; gap: 29px; margin-bottom: 23px; border-bottom: 1px solid #1711261c; }
.workspace-nav button { min-height: 47px; position: relative; border: 0; padding: 0 0 10px; background: transparent; color: var(--muted); font-weight: 680; }
.workspace-nav button[aria-pressed=true] { color: var(--ink); font-weight: 800; }
.workspace-nav button:hover { color: var(--ink); }
.workspace-nav button[aria-pressed=true]::after { content: ""; height: 3px; width: 24px; position: absolute; bottom: 0; left: calc(50% - 12px); border-radius: 10px; background: var(--ink); }

.primary, .secondary { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; padding: 0 18px; border: 1px solid transparent; border-radius: 999px; white-space: nowrap; font-weight: 690; text-decoration: none; }
.primary { background: var(--action); color: white; }
.primary:hover:enabled, .primary[href]:hover, .primary.file-button:hover { background: var(--action-hover); }
.primary:disabled { background: #e5e1ec; color: #5d596a; }
.secondary { border-color: #dfd8f0; background: #f2eeff; color: #362486; }
.secondary:hover:enabled, .secondary.file-button:hover { background: #e8dfff; }
.secondary:disabled { opacity: .72; }
.quiet { min-height: 36px; border-radius: 999px; border: 0; background: transparent; color: #3e315e; padding: 5px 11px; font-size: .875rem; font-weight: 650; text-decoration: none; }
.quiet:hover { background: var(--tint); }
.quiet.danger { color: #9e2d45; }

.library-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 17px; }
.search { position: relative; display: block; flex: 1 1 230px; max-width: 425px; }
.search input { display: block; width: 100%; min-height: 44px; padding: 0 15px 0 41px; appearance: none; border: 0; border-radius: 999px; background: #ffffffb8; color: var(--ink); box-shadow: 0 2px 9px #243e6c0d; transition: background .16s ease, box-shadow .16s ease; }
.search input:focus { outline: none; background: #fff; box-shadow: 0 4px 17px #334d8033; }
.search input:focus-visible { outline: 2px solid transparent; }
.magnify { width: 13px; height: 13px; border-radius: 50%; border: 1.8px solid var(--muted); position: absolute; left: 16px; top: 14px; pointer-events: none; }
.magnify::after { content: ""; position: absolute; width: 6px; height: 2px; background: var(--muted); bottom: -3px; right: -5px; transform: rotate(45deg); }
.count { color: var(--muted); font-size: .875rem; white-space: nowrap; }
#upload { margin-left: auto; }

.cards { --logo-size: 168px; display: grid; grid-template-columns: repeat(auto-fill, var(--logo-size)); align-items: start; gap: 20px 16px; }
.card { position: relative; min-width: 0; }
.thumb {
  position: relative; display: grid; place-items: center;
  width: 100%; aspect-ratio: 1; overflow: hidden; border-radius: 16px;
  background: #fff; transition: box-shadow .16s ease, transform .16s ease;
}
.logo-download:hover, .logo-download:focus-visible { box-shadow: 0 7px 18px #223b6930; }
.thumb img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: contain; }
.thumb-pending { max-width: 100%; text-align: center; color: var(--muted); font-size: .8125rem; }
.card-manage { margin-top: 4px; padding-inline: 3px; font-size: .8125rem; }

.panel, dialog { background: #fff; border: 1px solid var(--line); border-radius: 29px; box-shadow: 0 12px 38px #2b1b5909; }
.panel { padding: 23px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
h2 { font-size: 1.2rem; letter-spacing: -.015em; }
.usage-panel { max-width: 520px; margin-bottom: 22px; }
.usage-heading { align-items: flex-start; margin-bottom: 10px; }
.usage-heading time { display: block; margin-top: 3px; color: var(--muted); font-size: .8125rem; }
.usage-filter { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0 0 12px; padding: 10px; border: 1px solid var(--line); border-radius: 11px; }
.usage-filter label { display: grid; gap: 5px; min-width: 0; color: var(--muted); font-size: .8125rem; }
.usage-filter input[type=date] { min-width: 0; min-height: 36px; padding-inline: 6px; font-size: .8125rem; }
.usage-filter-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 7px; }
.usage-filter-actions button { min-height: 33px; padding-inline: 9px; font-size: .8125rem; }
.usage-range-caption { margin: 0 0 6px; color: var(--muted); font-size: .8125rem; }
.usage-counts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0; }
.usage-card { min-width: 0; padding: 11px; border: 1px solid var(--line); border-radius: 11px; }
.usage-card-summary { grid-column: 1 / -1; border-color: transparent; background: var(--tint); }
.usage-card dt, .usage-card-today { color: var(--muted); font-size: .8125rem; }
.usage-card dd { margin: 0; }
.usage-metric { display: flex; flex-wrap: wrap; align-items: baseline; gap: 3px 5px; color: var(--accent); font-size: .8125rem; }
.usage-metric strong { color: var(--ink); font-size: 1.5rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.usage-card-summary .usage-metric strong { font-size: 1.875rem; }
.usage-footer { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.usage-footer:has(> :not([hidden])) { margin-top: 10px; }
.usage-footer p { color: var(--muted); font-size: .8125rem; }
.usage-footer button { min-height: 36px; padding-inline: 12px; font-size: .875rem; }
.usage-access-hint { margin-bottom: 14px; color: var(--muted); font-size: .8125rem; }
.usage-notice { margin-top: 28px; color: var(--muted); font-size: .8125rem; }
@media (max-width: 320px) {
  .usage-filter { grid-template-columns: 1fr; }
}
.empty { min-height: 265px; display: grid; place-content: center; justify-items: center; text-align: center; }
.empty-mark { width: 49px; height: 49px; background: linear-gradient(135deg, #daebff, #eae1fd); border: 1px solid #bfcdf2; border-radius: 16px; margin-bottom: 15px; transform: rotate(-7deg); box-shadow: 5px 5px 0 #edf0fa; }
.empty h3 { font-size: 1.02rem; }
.empty p, #crop-placeholder { font-size: .875rem; color: var(--muted); margin-top: 9px; line-height: 1.55; }

.crop-workspace { max-width: 850px; }
.crop-workspace .panel-heading { min-height: 40px; }
.tool-drop { position: relative; display: grid; place-items: center; min-height: 250px; border: 1px dashed #b5bee2; border-radius: 20px; background: linear-gradient(135deg, #f0f8ff, #f8f2ff); overflow: hidden; text-align: center; }
.tool-drop.over { border-color: var(--focus); background: #eaf1ff; }
.tool-drop.has-image { border: 1px solid #e8e3f2; background: conic-gradient(#efecf6 25%, #fbfaff 0 50%, #efecf6 0 75%, #fbfaff 0) 0 0 / 24px 24px; }
.tool-drop.has-image.over { outline: 2px dashed var(--focus); outline-offset: -2px; }
.tool-empty { display: grid; justify-items: center; padding: 18px; }
#tool-browse::after { content: ""; position: absolute; inset: 0; }
.crop-workspace:has(#tool-file:focus-visible) .file-button:not([hidden]) { outline: 2px solid var(--focus); outline-offset: 4px; }
#tool-replace { min-height: 38px; font-size: .875rem; }
#canvas { display: block; width: auto; height: auto; max-width: min(85%, 360px); max-height: 220px; filter: drop-shadow(0 7px 10px #27203a23); cursor: grab; touch-action: none; }
#canvas.is-dragging { cursor: grabbing; }
#canvas.is-sampling { cursor: crosshair; outline: 2px dashed var(--focus); outline-offset: 3px; }
.tool-drop:has(#canvas.is-dragging)::after,
.crop-workspace:has(.tool-position input:focus) .tool-drop.has-image::after {
  position: absolute;
  inset: 7px;
  pointer-events: none;
  content: "";
  background:
    repeating-linear-gradient(90deg, var(--focus) 0 5px, #fff 5px 8px, transparent 8px 12px) center / 100% 1px no-repeat,
    repeating-linear-gradient(0deg, var(--focus) 0 5px, #fff 5px 8px, transparent 8px 12px) center / 1px 100% no-repeat;
}
.tool-meta { display: flex; gap: 10px; align-items: center; justify-content: space-between; margin: 14px 0 19px; font-size: .875rem; color: var(--muted); }
#tool-file-caption { min-width: 0; overflow-wrap: anywhere; }
.format { border-radius: 7px; background: var(--tint); color: #412d91; font-weight: 710; padding: 4px 8px; white-space: nowrap; }
fieldset { border: 0; padding: 0; margin: 0; min-inline-size: 0; }
#controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.crop-control p { color: var(--muted); font-size: .875rem; line-height: 1.45; }
.slider-label { display: flex; align-items: center; justify-content: space-between; font-size: .875rem; font-weight: 680; }
output { color: var(--accent); font-variant-numeric: tabular-nums; }
input[type=range] { display: block; width: 100%; height: 28px; margin: 5px 0 8px; accent-color: var(--accent); }
.presets { display: flex; flex-wrap: wrap; gap: 7px; }
.presets button { min-height: 34px; padding: 0 13px; border: 1px solid var(--line); background: white; border-radius: 999px; color: var(--muted); font-size: .875rem; }
.presets button:hover:enabled, .presets button[aria-pressed=true] { background: var(--tint); color: var(--accent); border-color: #d9cffb; }
.presets button:disabled { opacity: .56; }
.tool-dimensions, .tool-background, .tool-position { grid-column: 1 / -1; }
.tool-section-label { margin-bottom: 7px; padding: 0; color: var(--ink); font-size: .875rem; font-weight: 680; }
.tool-dimension-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; max-width: 350px; }
.tool-dimension-fields label { display: grid; gap: 5px; color: var(--muted); font-size: .8125rem; }
.tool-background-options, .tool-background-choices { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.tool-background-choices label { display: inline-flex; align-items: center; gap: 5px; min-height: 33px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); font-size: .8125rem; cursor: pointer; white-space: nowrap; }
.tool-background-choices label:has(:checked) { border-color: var(--focus); background: var(--tint); color: var(--accent); }
.tool-background-choices input { width: 13px; height: 13px; margin: 0; accent-color: var(--action); }
#tool-eyedropper { min-height: 33px; padding-inline: 10px; font-size: .8125rem; }
.tool-color-fields { display: grid; grid-template-columns: 38px minmax(0, 106px); gap: 7px; margin-top: 8px; }
#tool-background-color { width: 38px; height: 36px; padding: 3px; border: 1px solid var(--line); border-radius: 7px; background: var(--tint); cursor: pointer; }
#tool-background-hex { min-height: 36px; padding-inline: 8px; font-size: .8125rem; font-variant-numeric: tabular-nums; }
.tool-matte-toggle { display: inline-flex; align-items: center; gap: 7px; min-height: 30px; margin-top: 5px; color: var(--muted); font-size: .8125rem; cursor: pointer; }
.tool-matte-toggle input { width: 14px; height: 14px; margin: 0; accent-color: var(--action); }
.tool-position-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tool-position-fields input[type=range] { margin-bottom: 0; }
.tool-position-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 7px; }
.tool-position-footer .tool-control-note { margin: 0; }
#tool-position-reset { min-height: 32px; padding-inline: 9px; font-size: .8125rem; }
.tool-control-note { margin-top: 6px; color: var(--muted); font-size: .8125rem; line-height: 1.45; }
.tool-control-note[role=status] { color: var(--accent); }
#controls input[aria-invalid=true] { border-color: #a6263b; }
.tool-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 19px; }
.tool-actions > * { flex: 1; }

input:not([type=range], [type=file], [type=checkbox], [type=radio], [type=color], [type=search]) { width: 100%; min-height: 44px; border: 1px solid #dcd8e7; border-radius: 12px; background: white; padding: 0 12px; color: var(--ink); }
input::placeholder { color: #676577; }
.gate { max-width: 810px; min-height: 375px; display: grid; grid-template-columns: .86fr 1fr; margin: 12px auto; background: white; border: 1px solid var(--line); border-radius: 31px; overflow: hidden; box-shadow: 0 16px 46px #28214d12; }
.gate-visual { position: relative; display: grid; place-items: center; min-height: 190px; background: radial-gradient(ellipse at 76% 25%, #c8bcfd, #ebe5fc 57%, #eff2ff); }
.ghost-shape, .solid-shape { width: 135px; height: 135px; }
.ghost-shape { transform: translate(-19px,-15px) rotate(-9deg); border: 1px solid #9786d4; border-radius: 24px; }
.solid-shape { position: absolute; transform: translate(9px,11px) rotate(7deg); display: grid; place-items: center; background: #171423; color: white; border-radius: 34px; font: 650 4rem Georgia, serif; box-shadow: 0 14px 26px #49396744; }
.gate-content { padding: clamp(23px, 6vw, 48px); align-self: center; }
.gate-content h1 { font-size: clamp(1.65rem, 3vw, 2.14rem); }
.gate-content form { margin-top: 24px; }
.gate form label, .upload-fields label { display: block; font-size: .875rem; font-weight: 680; margin-bottom: 7px; }
.gate button { margin-top: 14px; width: 100%; }

dialog { width: min(470px, calc(100% - 28px)); padding: 23px; color: var(--ink); }
dialog::backdrop { background: #20193672; }
#asset-details label, #file-fields label { margin-top: 14px; }
.prepared-note { margin: 0 0 14px; color: var(--muted); font-size: .875rem; }
.optional, .drop p { font-size: .875rem; color: var(--muted); font-weight: 400; }
.drop { border: 1px dashed #c0b3f0; background: #f9f7ff; padding: 13px; border-radius: 13px; }
.drop.over { border-color: var(--accent); background: var(--tint); }
.drop input { max-width: 100%; font-size: .875rem; }
.drop p { margin-top: 7px; overflow-wrap: anywhere; }
.dialog-footer { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 18px; }
.dialog-footer .primary { margin-left: auto; }
.form-error { color: #a6263b; font-size: .875rem; margin-top: 10px; line-height: 1.5; }
.close { font-size: 1.35rem; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); max-width: calc(100% - 30px); background: #28213d; color: white; border-radius: 999px; padding: 11px 17px; box-shadow: 0 8px 26px #26203f33; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 650px) {
  .header-inner, .container { width: calc(100% - 34px); }
  .header-inner { height: 58px; }
  .container { padding-top: 43px; }
  .page-head { margin-bottom: 24px; }
  .workspace-nav { margin-bottom: 17px; }
  .library-toolbar { gap: 8px; }
  .search { flex-basis: 100%; max-width: none; }
  .cards { --logo-size: clamp(96px, calc((100vw - 54px) / 3), 116px); gap: 14px 10px; }
  .panel { padding: 16px; border-radius: 22px; }
  .tool-drop { min-height: 195px; }
  #controls { grid-template-columns: 1fr; gap: 13px; }
  .gate { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .thumb, .search input { transition: none; }
}
@media (forced-colors: active) {
  .search input { outline: 1px solid ButtonText; outline-offset: 0; }
  .search input:focus-visible { outline-color: Highlight; outline-offset: 2px; }
}
