.ipc-overlay {
  position: fixed;
  inset: 0;
  z-index: 32200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(28, 34, 43, .38);
  opacity: 0;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: opacity .18s ease;
}

.ipc-overlay.show { opacity: 1; }

.ipc-dialog {
  width: min(920px, calc(100vw - 40px));
  height: min(720px, calc(100vh - 40px));
  min-height: 560px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(39, 52, 73, .13);
  border-radius: 20px;
  background: #f7f9fb;
  color: #273449;
  box-shadow: 0 30px 90px rgba(24, 32, 44, .3);
  transform: translateY(12px) scale(.985);
  transition: transform .2s cubic-bezier(.2, .8, .2, 1);
}

.ipc-overlay.show .ipc-dialog { transform: translateY(0) scale(1); }

.ipc-head {
  position: relative;
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 48px 15px 24px;
  border-bottom: 1px solid rgba(39, 52, 73, .09);
  background: rgba(255, 255, 255, .92);
}

.ipc-head h3 { margin: 0; font-size: 20px; line-height: 1.25; letter-spacing: 0; }
.ipc-head p { margin: 5px 0 0; color: #7a8492; font-size: 12px; line-height: 1.35; }

.ipc-close {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 4;
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 999px;
  background: #ff5c60;
  padding: 0;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .14);
  transition: transform .16s ease, box-shadow .2s ease, filter .18s ease;
}

.ipc-close::before,
.ipc-close::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 7px;
  width: 8px;
  height: 2px;
  border-radius: 2px;
  background: #802f31;
  opacity: 0;
  transform: rotate(45deg);
  transition: opacity .16s ease;
}

.ipc-close::after { transform: rotate(-45deg); }
.ipc-close:hover { transform: scale(1.2); box-shadow: 0 6px 14px rgba(0,0,0,.2); filter: brightness(1.04); }
.ipc-close:hover::before, .ipc-close:hover::after { opacity: 1; }
.ipc-close:active { transform: scale(1.08); }
.ipc-close:focus-visible { outline: 2px solid rgba(255, 92, 96, .35); outline-offset: 3px; }

.ipc-body { flex: 1; min-height: 0; position: relative; }
.ipc-home { height: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-rows: 230px; gap: 16px; padding: 28px; align-content: start; overflow-y: auto; }
.ipc-home[hidden], .ipc-calibration[hidden], .ipc-smart-upload[hidden], .ipc-review[hidden] { display: none; }

.ipc-tool-card {
  position: relative;
  min-height: 230px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 24px;
  overflow: hidden;
  border: 1px solid rgba(39, 52, 73, .11);
  border-radius: 16px;
  background: #fff;
  color: #273449;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(39, 52, 73, .08);
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.ipc-tool-card:hover { transform: translateY(-3px); border-color: rgba(79, 131, 184, .34); box-shadow: 0 18px 36px rgba(39, 52, 73, .12); }
.ipc-tool-card:disabled {
  border-color: rgba(39,52,73,.08);
  background: rgba(255,255,255,.66);
  color: #7d8793;
  box-shadow: none;
  cursor: not-allowed;
  filter: saturate(.45);
  opacity: .58;
}
.ipc-tool-card:disabled:hover { transform: none; border-color: rgba(39,52,73,.08); box-shadow: none; }
.ipc-tool-card:disabled > svg { opacity: .28; }
.ipc-tool-card-coming { border-style: dashed; background: rgba(255,255,255,.55); color: #7e8997; cursor: default; box-shadow: none; }
.ipc-tool-card-coming:hover { transform: none; border-color: rgba(39,52,73,.11); box-shadow: none; }
.ipc-tool-card-coming strong { color: #697687; }
.ipc-tool-card-coming small { color: #9aa3ae; }
.ipc-tool-card strong { display: block; margin-bottom: 7px; font-size: 18px; letter-spacing: 0; }
.ipc-tool-card small { display: block; max-width: 280px; color: #758090; font-size: 13px; line-height: 1.55; }
.ipc-tool-card em { position: absolute; right: 18px; top: 18px; padding: 5px 9px; border-radius: 999px; background: #f0f2f4; color: #8b939e; font-size: 11px; font-style: normal; }
.ipc-tool-card > svg { position: absolute; right: 22px; bottom: 24px; width: 22px; height: 22px; fill: none; stroke: #607185; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.ipc-tool-icon { position: absolute; left: 24px; top: 22px; width: 108px; height: 94px; }
.ipc-tool-icon.smart-upload::before { content: ""; position: absolute; left: 5px; top: 17px; width: 86px; height: 61px; border: 5px solid #fff; border-radius: 13px; background: linear-gradient(180deg, #c5e9f8 0 58%, #62b89c 59%); box-shadow: 6px 7px 0 #91aabd, 0 12px 18px rgba(39,52,73,.16); }
.ipc-tool-icon.smart-upload::after { content: ""; position: absolute; left: 16px; top: 7px; width: 39px; height: 20px; border-radius: 9px 9px 2px 2px; background: #ffda67; transform: skewX(-18deg); }
.ipc-tool-icon.smart-upload i { position: absolute; left: 45px; top: 31px; z-index: 2; width: 9px; height: 29px; border-radius: 999px; background: #607185; }
.ipc-tool-icon.smart-upload i::before { content: ""; position: absolute; left: -8px; top: -3px; border-left: 12px solid transparent; border-right: 12px solid transparent; border-bottom: 13px solid #607185; }
.ipc-tool-icon.smart-upload b { position: absolute; right: 3px; bottom: 3px; z-index: 3; width: 25px; height: 25px; border: 4px solid #fff; border-radius: 50%; background: #62b89c; box-shadow: 0 5px 9px rgba(39,52,73,.16); }
.ipc-tool-icon.smart-upload b::before { content: ""; position: absolute; left: 5px; top: 9px; width: 5px; height: 2px; border-radius: 999px; background: #fff; transform: rotate(45deg); }
.ipc-tool-icon.smart-upload b::after { content: ""; position: absolute; left: 8px; top: 7px; width: 10px; height: 2px; border-radius: 999px; background: #fff; transform: rotate(-45deg); }
.ipc-tool-icon.crop::before { content: ""; position: absolute; left: 16px; top: 11px; width: 74px; height: 62px; border: 5px solid #fff; border-radius: 14px; background: linear-gradient(180deg, #c5e9f8 0 58%, #62b89c 59%); box-shadow: 6px 7px 0 #91aabd, 0 12px 18px rgba(39,52,73,.16); transform: rotate(-4deg); transform-origin: 50% 50%; }
.ipc-tool-icon.crop::after { content: ""; position: absolute; left: 1px; top: 1px; width: 43px; height: 43px; box-sizing: border-box; border-left: 7px solid #ffda67; border-top: 7px solid #ffda67; border-radius: 12px 0 0; }
.ipc-tool-icon.crop i { position: absolute; right: 1px; bottom: 1px; width: 43px; height: 43px; box-sizing: border-box; border-right: 7px solid #ffda67; border-bottom: 7px solid #ffda67; border-radius: 0 0 12px; }

.ipc-tool-icon.color::before,
.ipc-tool-icon.color::after { content: ""; position: absolute; top: 12px; width: 60px; height: 68px; border: 5px solid #fff; border-radius: 13px; box-shadow: 0 12px 18px rgba(39,52,73,.15); }
.ipc-tool-icon.color::before { left: 0; background: linear-gradient(180deg, #dfc9ec 0 58%, #b174ad 59%); }
.ipc-tool-icon.color::after { right: 0; background: linear-gradient(180deg, #c5e9f8 0 58%, #62b89c 59%); }
.ipc-tool-icon.color i { position: absolute; left: 47px; top: 42px; z-index: 3; width: 18px; height: 8px; border-radius: 999px; background: #607185; }
.ipc-tool-icon.color i::after { content: ""; position: absolute; right: -7px; top: -4px; border-left: 9px solid #607185; border-top: 8px solid transparent; border-bottom: 8px solid transparent; }
.ipc-tool-icon.color b { position: absolute; left: 42px; bottom: 1px; z-index: 4; width: 26px; height: 12px; border: 3px solid #fff; border-radius: 999px; background: linear-gradient(90deg, #f08b91 0 33%, #ffda67 34% 66%, #62b89c 67%); box-shadow: 0 5px 8px rgba(39,52,73,.14); }
.ipc-tool-icon.compose::before { content: ""; position: absolute; left: 8px; top: 14px; width: 78px; height: 62px; border: 5px solid #fff; border-radius: 14px; background: #f3f6f9; box-shadow: 6px 7px 0 #91aabd, 0 12px 18px rgba(39,52,73,.16); }
.ipc-tool-icon.compose i { position: absolute; z-index: 2; width: 38px; height: 28px; border: 4px solid #fff; border-radius: 9px; box-shadow: 0 6px 10px rgba(39,52,73,.13); }
.ipc-tool-icon.compose i:first-child { left: 3px; top: 6px; background: linear-gradient(180deg,#c5e9f8 0 58%,#62b89c 59%); transform: rotate(-7deg); }
.ipc-tool-icon.compose i:nth-child(2) { right: 7px; top: 19px; background: linear-gradient(180deg,#dfc9ec 0 58%,#b174ad 59%); transform: rotate(6deg); }
.ipc-tool-icon.compose b { position: absolute; left: 31px; bottom: 5px; z-index: 3; width: 44px; height: 30px; border: 4px solid #fff; border-radius: 10px; background: linear-gradient(180deg,#ffeca0 0 54%,#ffda67 55%); box-shadow: 0 7px 12px rgba(39,52,73,.16); }
.ipc-tool-icon.compose b::before { content: ""; position: absolute; left: 6px; top: 7px; width: 30px; height: 4px; border-radius: 999px; background: #607185; box-shadow: 0 8px 0 #607185; opacity: .78; }
.ipc-tool-icon.material-library .ipc-material-library-art { position: absolute; left: -2px; top: 0; width: 112px; height: 94px; display: block; overflow: visible; object-fit: contain; filter: drop-shadow(0 10px 9px rgba(9,16,22,.28)); }
.ipc-tool-icon.coming { display: flex; align-items: center; justify-content: center; gap: 9px; width: 94px; height: 76px; border: 2px dashed #c8d0d8; border-radius: 15px; background: rgba(238,242,245,.72); }
.ipc-tool-icon.coming i { width: 10px; height: 10px; border-radius: 50%; background: #aeb8c3; }
.ipc-tool-icon.coming i:nth-child(2) { background: #c4a8d2; }
.ipc-tool-icon.coming i:nth-child(3) { background: #8ec8b5; }

.ipc-calibration { height: 100%; display: flex; flex-direction: column; min-height: 0; }
.ipc-smart-upload { height: 100%; display: flex; flex-direction: column; min-height: 0; background: #eef2f5; }
.ipc-smart-upload-frame-wrap { position: relative; flex: 1; min-height: 0; overflow: hidden; background: #eef2f5; }
.ipc-smart-upload-frame-wrap iframe { width: 100%; height: 100%; display: block; border: 0; background: #eef2f5; }
.ipc-smart-upload-loading { position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; background: #eef2f5; color: #44546a; }
.ipc-smart-upload-loading[hidden] { display: none; }
.ipc-smart-upload-loading i { position: relative; width: 34px; height: 34px; margin-bottom: 16px; border: 3px solid #d7e0e8; border-top-color: #62b89c; border-radius: 50%; animation: ipc-spin .8s linear infinite; }
.ipc-smart-upload-loading.is-error i { width: 34px; height: 34px; border: 0; background: #e7edf1; animation: none; }
.ipc-smart-upload-loading.is-error i::before, .ipc-smart-upload-loading.is-error i::after { content: ""; position: absolute; left: 50%; top: 50%; width: 15px; height: 2px; border-radius: 999px; background: #8793a0; transform: translate(-50%, -50%) rotate(45deg); }
.ipc-smart-upload-loading.is-error i::after { transform: translate(-50%, -50%) rotate(-45deg); }
.ipc-smart-upload-loading strong { font-size: 14px; }
.ipc-smart-upload-loading span { margin-top: 7px; color: #7b8795; font-size: 12px; }
@keyframes ipc-spin { to { transform: rotate(360deg); } }
.ipc-toolbar { min-height: 54px; display: flex; align-items: center; gap: 10px; padding: 9px 18px; border-bottom: 1px solid rgba(39,52,73,.08); background: #fff; }
.ipc-toolbar > span { font-size: 15px; font-weight: 750; }
.ipc-back { width: 34px; height: 34px; display: grid; place-items: center; border: 0; border-radius: 9px; background: #eef1f4; cursor: pointer; }
.ipc-back svg { width: 20px; height: 20px; fill: none; stroke: #526579; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ipc-reset { margin-left: auto; min-height: 34px; padding: 0 13px; border: 1px solid rgba(39,52,73,.12); border-radius: 9px; background: #fff; color: #657184; cursor: pointer; }

.ipc-pair { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 64px minmax(0, 1fr); gap: 13px; padding: 18px 22px 10px; }
.ipc-upload-panel { min-width: 0; min-height: 0; display: flex; flex-direction: column; padding: 14px; border: 1px solid rgba(39,52,73,.1); border-radius: 14px; background: #fff; transition: border-color .18s ease, box-shadow .18s ease; }
.ipc-upload-panel.is-dragging { border-color: #d3a315; box-shadow: 0 0 0 4px rgba(255,218,103,.2); }
.ipc-upload-panel header { display: flex; align-items: center; justify-content: space-between; min-height: 30px; padding: 0 2px 10px; }
.ipc-upload-panel header strong { font-size: 14px; }
.ipc-upload-panel header span { color: #8a94a1; font-size: 11px; }
.ipc-upload-panel footer { min-height: 30px; padding: 9px 2px 0; overflow: hidden; color: #7b8695; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }

.ipc-drop-zone { flex: 1; min-height: 250px; display: grid; place-items: center; padding: 12px; overflow: hidden; border: 1.5px dashed rgba(84,104,126,.28); border-radius: 11px; background: #f4f7f9; cursor: pointer; }
.ipc-drop-zone:hover { border-color: rgba(79,131,184,.55); background: #f0f6fa; }
.ipc-drop-zone img { width: 100%; height: 100%; display: block; object-fit: contain; }
.ipc-drop-zone img[hidden] { display: none; }
.ipc-upload-placeholder { display: flex; flex-direction: column; align-items: center; color: #718092; }
.ipc-upload-placeholder[hidden] { display: none; }
.ipc-upload-placeholder b { margin-top: 15px; color: #44546a; font-size: 14px; }
.ipc-upload-placeholder small { margin-top: 5px; font-size: 11px; }
.ipc-image-mark { position: relative; width: 56px; height: 46px; border: 4px solid #7bb3d5; border-radius: 9px; background: linear-gradient(180deg,#c6eafa 0 58%,#66b89d 59%); box-shadow: 4px 5px 0 #cbd8e2; }
.ipc-image-mark::after { content: ""; position: absolute; right: 8px; top: 7px; width: 9px; height: 9px; border-radius: 50%; background: #ffda67; }

.ipc-transfer { display: flex; align-items: center; justify-content: center; gap: 3px; color: #607185; }
.ipc-transfer i { width: 8px; height: 8px; border-radius: 50%; }
.ipc-transfer i:nth-child(1) { background: #f08b91; }
.ipc-transfer i:nth-child(2) { background: #ffda67; }
.ipc-transfer i:nth-child(3) { background: #62b89c; }
.ipc-transfer svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.ipc-actions { position: relative; min-height: 67px; display: flex; align-items: center; justify-content: center; gap: 16px; padding: 10px 22px 16px; }
.ipc-status { position: absolute; left: 22px; color: #788493; font-size: 12px; }
.ipc-primary, .ipc-secondary { min-height: 40px; padding: 0 18px; border-radius: 10px; font: inherit; font-size: 13px; cursor: pointer; }
.ipc-primary { border: 1px solid #e1ac00; background: linear-gradient(180deg,#ffe477,#ffd13f 52%,#f0b900); color: #332600; font-weight: 720; box-shadow: 0 3px 10px rgba(225,172,0,.24), inset 0 1px rgba(255,255,255,.58); }
.ipc-primary:disabled { opacity: .45; cursor: default; box-shadow: none; }
.ipc-secondary { border: 1px solid rgba(39,52,73,.13); background: #fff; color: #58677a; }

.ipc-review { position: absolute; inset: 54px 0 0; background: #25282d; }
.ipc-review-stage { position: absolute; inset: 0 0 70px; display: grid; place-items: center; padding: 18px; overflow: hidden; }
.ipc-review-stage canvas { width: auto; height: auto; max-width: 100%; max-height: 100%; display: block; object-fit: contain; box-shadow: 0 12px 34px rgba(0,0,0,.26); }
.ipc-review-actions { position: absolute; left: 0; right: 0; bottom: 0; min-height: 70px; display: flex; align-items: center; justify-content: center; gap: 12px; border-top: 1px solid rgba(255,255,255,.09); background: #1d1f23; }

.ipc-compose-result-dialog { width: min(1040px, calc(100vw - 40px)); height: min(820px, calc(100vh - 40px)); min-height: 580px; }
.ipc-compose-result-body { flex: 1 1 auto; min-height: 0; display: flex; padding: 18px; overflow: hidden; background: #25282d; }
.ipc-compose-result-stage { width: 100%; height: 100%; min-width: 0; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.ipc-compose-result-stage img { width: auto; height: auto; max-width: 100%; max-height: 100%; display: block; object-fit: contain; border-radius: 8px; box-shadow: 0 16px 44px rgba(0,0,0,.28); background: #fff; }
.ipc-compose-result-footer { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 20px; border-top: 1px solid rgba(39,52,73,.08); background: #fff; }
.ipc-compose-result-footer > span { min-width: 0; overflow: hidden; color: #6c7887; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.ipc-compose-result-footer > div { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }

html.theme-dark .ipc-dialog { background: #20252c; color: #eef4fb; border-color: rgba(255,255,255,.1); }
html.theme-dark .ipc-head, html.theme-dark .ipc-toolbar { background: #252b33; border-color: rgba(255,255,255,.08); }
html.theme-dark .ipc-head p { color: #929dab; }
html.theme-dark .ipc-close { background: #ff5c60; }
html.theme-dark .ipc-back { background: #343c46; }
html.theme-dark .ipc-close::before, html.theme-dark .ipc-close::after { background: #802f31; }
html.theme-dark .ipc-tool-card, html.theme-dark .ipc-upload-panel { background: #292f37; color: #eef4fb; border-color: rgba(255,255,255,.1); }
html.theme-dark .ipc-tool-card-coming { background: rgba(41,47,55,.45); color: #9aa5b2; border-color: rgba(255,255,255,.12); box-shadow: none; }
html.theme-dark .ipc-tool-card-coming:hover { border-color: rgba(255,255,255,.12); }
html.theme-dark .ipc-tool-card-coming strong { color: #aeb7c1; }
html.theme-dark .ipc-tool-icon.coming { border-color: #56616d; background: rgba(32,37,44,.7); }
html.theme-dark .ipc-tool-card small, html.theme-dark .ipc-status, html.theme-dark .ipc-upload-panel footer { color: #9aa5b2; }
html.theme-dark .ipc-tool-card em { background: #343b44; color: #aab3bd; }
html.theme-dark .ipc-reset, html.theme-dark .ipc-secondary { background: #303740; color: #d7e0e9; border-color: rgba(255,255,255,.12); }
html.theme-dark .ipc-drop-zone { background: #20252b; border-color: rgba(255,255,255,.15); }
html.theme-dark .ipc-upload-placeholder b { color: #dbe5ee; }
html.theme-dark .ipc-smart-upload, html.theme-dark .ipc-smart-upload-frame-wrap, html.theme-dark .ipc-smart-upload-frame-wrap iframe, html.theme-dark .ipc-smart-upload-loading { background: #20252c; }
html.theme-dark .ipc-smart-upload-loading { color: #eef4fb; }
html.theme-dark .ipc-compose-result-footer { background: #252b33; border-color: rgba(255,255,255,.08); }
html.theme-dark .ipc-compose-result-footer > span { color: #a5afbb; }

@media (max-width: 760px) {
  .ipc-overlay { padding: 0; }
  .ipc-dialog { width: 100vw; height: 100vh; min-height: 0; border-radius: 0; }
  .ipc-home { grid-template-columns: 1fr; grid-auto-rows: 200px; padding: 16px; overflow-y: auto; align-content: start; }
  .ipc-tool-card { min-height: 200px; }
  .ipc-pair { grid-template-columns: 1fr; grid-template-rows: minmax(210px, 1fr) 38px minmax(210px, 1fr); overflow-y: auto; }
  .ipc-transfer { transform: rotate(90deg); }
  .ipc-drop-zone { min-height: 170px; }
  .ipc-actions { flex-wrap: wrap; }
  .ipc-status { position: static; width: 100%; text-align: center; }
}
