/* FreeAssetHub editor */
:root { --bg:#eef0f6; --card:#fff; --fg:#141824; --muted:#5b6477; --line:#e3e6ee; --brand:#4f46e5; --brand-d:#3d35c4; --soft:#eef0ff; }
@media (prefers-color-scheme: dark) {
  :root { --bg:#14161d; --card:#1d2029; --fg:#eceef5; --muted:#9aa3b8; --line:#2c3040; --soft:#262a45; }
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--fg); display: flex; flex-direction: column; overflow: hidden; }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.eh { height: 56px; flex: none; display: flex; align-items: center; gap: 10px; padding: 0 14px; background: var(--card); border-bottom: 1px solid var(--line); }
.eh-logo { font-weight: 800; font-size: 18px; color: var(--fg); text-decoration: none; letter-spacing: -.3px; }
.eh-logo b { color: var(--brand); }
.eh-sp { flex: 1; }
.eh select { height: 36px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); padding: 0 8px; max-width: 220px; }
.ib { height: 36px; min-width: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); font-size: 16px; line-height: 1; }
.ib:hover:not(:disabled) { background: var(--soft); }
.ib:disabled { opacity: .4; cursor: default; }
.ib.on { background: var(--soft); border-color: var(--brand); color: var(--brand); }
.pri { height: 36px; padding: 0 18px; border: 0; border-radius: 8px; background: var(--brand); color: #fff; font-weight: 700; }
.pri:hover { background: var(--brand-d); }
.dlw { position: relative; }
.dlm { position: absolute; right: 0; top: 44px; z-index: 50; width: 220px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: grid; gap: 10px; box-shadow: 0 12px 40px rgba(0,0,0,.2); }
.dlm label { display: grid; gap: 4px; color: var(--muted); font-size: 12px; }
.dlm select { max-width: none; width: 100%; }

.ctx { flex: none; min-height: 48px; display: flex; align-items: center; gap: 8px; padding: 6px 14px; background: var(--card); border-bottom: 1px solid var(--line); overflow-x: auto; white-space: nowrap; }
.ctx:empty::before { content: attr(data-hint); color: var(--muted); }
.ctx .sep { width: 1px; height: 24px; background: var(--line); margin: 0 4px; flex: none; }
.ctx input[type=color] { width: 36px; height: 36px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); flex: none; }
.ctx input[type=number] { width: 64px; height: 36px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); padding: 0 6px; }
.ctx select { height: 36px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); max-width: 150px; }
.ctx input[type=range] { width: 90px; }
.ctx label { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; flex: none; }

.ew { flex: 1; min-height: 0; display: flex; }
.tabs { width: 78px; flex: none; background: var(--card); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 8px 0; }
.tabs button { border: 0; background: none; padding: 10px 4px; display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--muted); font-size: 11px; }
.tabs button i { font-style: normal; font-size: 20px; line-height: 1; }
.tabs button.on { color: var(--brand); background: var(--soft); }
.panel { width: 300px; flex: none; background: var(--card); border-right: 1px solid var(--line); overflow-y: auto; padding: 14px; }
.pane { display: none; }
.pane.on { display: block; }
.pane h4 { margin: 18px 0 8px; font-size: 13px; color: var(--muted); font-weight: 600; }

.srch { display: flex; gap: 6px; }
.srch input { flex: 1; min-width: 0; height: 38px; border: 1px solid var(--line); border-radius: 10px; padding: 0 10px; background: var(--bg); }
.srch button { width: 38px; border: 0; border-radius: 10px; background: var(--brand); color: #fff; }
.chips { display: flex; gap: 6px; margin: 10px 0; }
.chips button { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 4px 12px; font-size: 12px; }
.chips button.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.agrid { columns: 2; column-gap: 8px; }
.ac { break-inside: avoid; margin: 0 0 8px; position: relative; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); cursor: pointer; display: block; width: 100%; padding: 0; background: repeating-conic-gradient(#e8eaf0 0 25%, #fff 0 50%) 0 0/14px 14px; }
.ac img { display: block; width: 100%; height: auto; }
.ac.ld::after { content: ""; position: absolute; inset: 0; background: rgba(255,255,255,.7) center/28px no-repeat; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .4; } }
.more { display: block; width: 100%; margin-top: 10px; padding: 9px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.more:hover { background: var(--soft); }
.empty { color: var(--muted); padding: 20px 4px; text-align: center; }

.tp { display: block; width: 100%; text-align: left; border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 12px; margin-bottom: 8px; }
.tp:hover { background: var(--soft); }
.tp.h1 { font: 700 26px Poppins, sans-serif; }
.tp.h2 { font: 700 18px Poppins, sans-serif; }
.tp.h3 { font: 400 14px Poppins, sans-serif; }
.fontlist { display: grid; gap: 8px; }
.fontlist button { text-align: left; border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 10px 12px; font-size: 20px; }
.fontlist button:hover { background: var(--soft); }
.shapes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.shapes button { aspect-ratio: 1; border: 1px solid var(--line); border-radius: 10px; background: var(--card); display: grid; place-items: center; }
.shapes button:hover { background: var(--soft); }
.shapes svg { width: 52%; height: 52%; fill: var(--fg); stroke: var(--fg); }
.up { display: grid; gap: 6px; place-items: center; text-align: center; border: 2px dashed var(--line); border-radius: 14px; padding: 36px 16px; cursor: pointer; }
.up:hover { border-color: var(--brand); background: var(--soft); }
.up small { color: var(--muted); }
.sw { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.sw button { aspect-ratio: 1; border-radius: 8px; border: 1px solid var(--line); padding: 0; }
.row { display: flex; align-items: center; justify-content: space-between; margin: 12px 0; }
.row input[type=color] { width: 44px; height: 32px; border: 1px solid var(--line); border-radius: 8px; padding: 2px; background: var(--card); }

.stage { flex: 1; min-width: 0; position: relative; overflow: auto; display: flex; }
.cwrap { margin: auto; padding: 12px; flex: none; }
.cwrap .canvas-container { background: none; }
.zoom { position: fixed; right: 14px; bottom: 14px; z-index: 20; display: flex; align-items: center; gap: 6px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 4px 6px; box-shadow: 0 4px 16px rgba(0,0,0,.15); }
.zoom span { min-width: 44px; text-align: center; font-size: 12px; color: var(--muted); }
.zoom .ib { height: 30px; min-width: 30px; border: 0; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100; background: #141824; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 13px; max-width: 90vw; }

@media (max-width: 820px) {
  .eh { gap: 6px; padding: 0 8px; }
  .eh-logo { display: none; }
  .eh-new { display: none; }
  .ew { flex-direction: column-reverse; }
  .tabs { width: auto; flex-direction: row; border-right: 0; border-top: 1px solid var(--line); padding: 0; overflow-x: auto; }
  .tabs button { flex: 1; min-width: 64px; padding: 8px 4px; }
  .panel { width: auto; height: 38vh; border-right: 0; border-top: 1px solid var(--line); }
  .cwrap { padding: 14px; }
  .zoom { bottom: calc(38vh + 70px); }
}

.adm { position: fixed; inset: 0; z-index: 2000; background: rgba(10,12,20,.6); display: flex; align-items: center; justify-content: center; padding: 16px; }
.adm-b { background: var(--card); color: var(--fg); max-width: 430px; width: 100%; border-radius: 16px; padding: 24px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.adm-b h3 { margin: 0 0 8px; font-size: 19px; }
.adm-b p { margin: 0 0 18px; color: var(--muted); line-height: 1.5; font-size: 15px; }
.adm-a { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.adm-a button { border: 0; border-radius: 10px; padding: 11px 18px; font-weight: 600; }
.adm-go { background: var(--brand); color: #fff; }
.adm-no { background: transparent; color: var(--muted); }

.ctx .tb { font-size: 13px; padding: 0 12px; font-weight: 600; white-space: nowrap; }

.hintp { color: var(--muted); font-size: 12px; margin: 0 0 10px; }
.layers { display: grid; gap: 6px; }
.lr { display: flex; align-items: center; gap: 8px; padding: 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); cursor: pointer; }
.lr.on { border-color: var(--brand); background: var(--soft); }
.lr.over { outline: 2px dashed var(--brand); }
.lr.hid { opacity: .5; }
.lr .th { width: 44px; height: 44px; flex: none; border-radius: 6px; border: 1px solid var(--line); background: repeating-conic-gradient(#e8eaf0 0 25%, #fff 0 50%) 0 0/10px 10px; display: grid; place-items: center; overflow: hidden; }
.lr .th img { max-width: 100%; max-height: 100%; display: block; }
.lr .nm { flex: 1; min-width: 0; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lr .nm small { display: block; color: var(--muted); font-size: 11px; }
.lr button { width: 26px; height: 26px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: var(--card); font-size: 13px; line-height: 1; flex: none; }
.lr button:hover:not(:disabled) { background: var(--soft); }
.lr button:disabled { opacity: .35; cursor: default; }
.lr button.act { background: var(--brand); color: #fff; border-color: var(--brand); }

/* collapsible panel + preview */
.ptog { flex: none; width: 16px; align-self: center; height: 64px; padding: 0; border: 1px solid var(--line); border-left: 0; border-radius: 0 8px 8px 0; background: var(--card); color: var(--muted); }
.ptog:hover { background: var(--soft); color: var(--brand); }
.ptog::before { content: "\2039"; font-size: 20px; line-height: 1; }
body.pc .ptog::before { content: "\203A"; }
body.pc .panel { display: none; }
body.pc .tabs { border-right: 1px solid var(--line); }
.panel { overflow-x: hidden; }
.layers { grid-template-columns: minmax(0, 1fr); }
.lr { min-width: 0; gap: 5px; padding: 5px; }
.lr .th { width: 38px; height: 38px; }
.lr button { width: 24px; height: 24px; }
.pvm { position: fixed; inset: 0; z-index: 2500; background: rgba(10,12,20,.82); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 56px 20px 40px; }
.pvb { max-width: 100%; max-height: 100%; min-height: 0; display: flex; background: repeating-conic-gradient(#d9dce6 0 25%, #fff 0 50%) 0 0/16px 16px; box-shadow: 0 10px 50px rgba(0,0,0,.5); }
.pvb img { display: block; max-width: 100%; max-height: calc(100vh - 110px); object-fit: contain; }
.pvx { position: absolute; top: 12px; right: 16px; width: 40px; height: 40px; border: 0; border-radius: 50%; background: rgba(255,255,255,.15); color: #fff; font-size: 26px; line-height: 1; }
.pvl { color: #cfd3e2; font-size: 12px; margin-top: 10px; }
@media (max-width: 820px) {
  .ptog { width: auto; height: 22px; align-self: stretch; border: 0; border-top: 1px solid var(--line); border-radius: 0; }
  .ptog::before { content: "\2304"; }
  body.pc .ptog::before { content: "\2303"; }
  body.pc .tabs { border-right: 0; }
  .eh-pv { padding: 0 8px; font-size: 13px; }
}

/* shadow popover */
.ctx .shb.on { background: var(--soft); border-color: var(--brand); color: var(--brand); }
.shp { position: fixed; z-index: 2200; width: 240px; background: var(--card); color: var(--fg); border: 1px solid var(--line); border-radius: 12px; padding: 12px; box-shadow: 0 12px 40px rgba(0,0,0,.25); display: grid; gap: 10px; }
.shp .shr { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12px; color: var(--muted); }
.shp .shr b { font-weight: 600; }
.shp .shr input[type=range] { flex: 1; max-width: 130px; }
.shp .shr input[type=color] { width: 40px; height: 28px; padding: 2px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); }
.shp .shn { border: 1px solid var(--line); background: var(--card); border-radius: 8px; padding: 4px 10px; font-size: 12px; }
.shp .shg { display: grid; grid-template-columns: repeat(3, 44px); gap: 6px; justify-content: center; }
.shp .shg button { height: 40px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); font-size: 18px; }
.shp button:hover { background: var(--soft); }
.shp button.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.ctx .fdb.on { background: var(--soft); border-color: var(--brand); color: var(--brand); }

@media (max-width: 520px) {
  .eh { gap: 4px; padding: 0 6px; }
  .eh select { max-width: 112px; min-width: 0; font-size: 12px; padding: 0 4px; }
  .eh .ib { min-width: 34px; padding: 0 6px; }
  .eh-pv { padding: 0 6px; font-size: 12px; }
  .eh .pri { padding: 0 12px; }
}

/* templates panel */
.tplchips { flex-wrap: wrap; }
.tplgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; align-items: start; }
.tc { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--card); padding: 0; cursor: pointer; display: flex; flex-direction: column; text-align: left; }
.tc:hover { border-color: var(--brand); }
.tph { position: relative; background: var(--soft); width: 100%; }
.tph img { display: block; width: 100%; height: 100%; object-fit: cover; }
.tph.ld::after { content: ""; position: absolute; inset: 0; background: rgba(255,255,255,.6); animation: pulse 1s infinite; }
.tc span { font-size: 11px; padding: 5px 7px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
