:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system,
    BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: #172033;
  background: #f5f7fb;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
}

a {
  color: #3156d9;
}

.site-header {
  box-sizing: border-box;
  position: sticky;
  top: 0;
  z-index: 5;
  height: 64px;
  min-height: 64px;
  border-bottom: 1px solid #dfe4ee;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
}

.header-inner {
  width: calc(100% - 40px);
  max-width: 1120px;
  height: 64px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 28px;
}

.brand {
  color: #172033;
  font-size: 1.05rem;
  font-weight: 750;
  text-decoration: none;
  white-space: nowrap;
}

.tool-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1;
  margin-left: auto;
}

.tool-nav a {
  padding: 9px 12px;
  border-radius: 9px;
  color: #59647a;
  font-size: 0.92rem;
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
}

.tool-nav a:hover {
  background: #f0f3f9;
  color: #172033;
}
.tool-nav a[aria-current='page'] {
  background: #e9edff;
  color: #2949c7;
}

.ecosystem {
  position: relative;
  white-space: nowrap;
}
.ecosystem summary {
  cursor: pointer;
  list-style: none;
  font-weight: 700;
}
.ecosystem-menu {
  position: absolute;
  right: 0;
  top: 34px;
  width: 180px;
  padding: 8px;
  display: grid;
  gap: 2px;
  background: white;
  border: 1px solid #dbe2ea;
  border-radius: 12px;
  box-shadow: 0 14px 30px #26364a24;
}
.ecosystem-menu a {
  padding: 9px 10px;
  color: #172033;
  text-decoration: none;
  border-radius: 7px;
}
.ecosystem-menu a:hover {
  background: #f0f4f8;
}

main {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 52px 0 40px;
}

.intro {
  max-width: 720px;
  margin-bottom: 28px;
}
.eyebrow {
  margin: 0 0 8px;
  color: #4d62c9;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 1.08;
  letter-spacing: -0.04em;
}
.intro > p:last-child {
  margin: 16px 0 0;
  color: #626d81;
  font-size: 1.05rem;
  line-height: 1.7;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.controls,
.result,
.notice {
  border: 1px solid #e0e5ef;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 10px 35px rgba(30, 45, 75, 0.06);
}

.controls {
  display: grid;
  gap: 20px;
  padding: 22px;
}
.controls label {
  display: grid;
  gap: 8px;
  color: #354057;
  font-size: 0.9rem;
  font-weight: 700;
}
.file-picker {
  padding: 18px;
  border: 1px dashed #9da9c4;
  border-radius: 13px;
  background: #f8f9fd;
}
.file-picker small {
  color: #748096;
  font-weight: 450;
  line-height: 1.45;
}

.options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 12px;
}
input,
select,
button {
  font: inherit;
}
select,
input[type='number'] {
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid #cbd2e0;
  border-radius: 9px;
  background: #fff;
  color: #172033;
}
input[type='file'] {
  width: 100%;
  color: #59647a;
  font-size: 0.88rem;
}
input[type='file']::file-selector-button {
  margin-right: 10px;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: #e9edff;
  color: #2949c7;
  font-weight: 700;
  cursor: pointer;
}
input[type='color'] {
  width: 100%;
  height: 42px;
  padding: 4px;
  border: 1px solid #cbd2e0;
  border-radius: 9px;
  background: #fff;
}
.number-input {
  position: relative;
}
.number-input span {
  position: absolute;
  top: 11px;
  right: 10px;
  color: #7b8598;
  font-size: 0.82rem;
  font-weight: 500;
}
.number-input input {
  padding-right: 32px;
}

.position-editor {
  display: grid;
  gap: 14px;
  padding-top: 18px;
  border-top: 1px solid #e6eaf2;
}
.position-editor h2 {
  margin: 0;
  font-size: 1rem;
}
.position-editor p {
  margin: 5px 0 0;
  color: #748096;
  font-size: 0.82rem;
  line-height: 1.45;
}
.thumbnail-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.thumbnail-item {
  position: relative;
  min-width: 0;
}
.thumbnail {
  position: relative;
  width: 100%;
  min-height: 60px;
  padding: 3px;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 9px;
  background: #edf0f6;
}
.thumbnail.selected {
  border-color: #3659db;
  background: #e9edff;
}
.thumbnail img {
  display: block;
  width: 100%;
  height: 54px;
  border-radius: 5px;
  object-fit: cover;
}
.thumbnail span {
  position: absolute;
  right: 5px;
  bottom: 5px;
  padding: 1px 5px;
  border-radius: 10px;
  background: rgba(20, 29, 48, 0.78);
  color: #fff;
  font-size: 0.7rem;
}
.remove-image {
  position: absolute;
  top: 5px;
  right: 5px;
  z-index: 1;
  min-height: 28px;
  padding: 3px 7px;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 7px;
  background: rgba(24, 32, 50, 0.82);
  font-size: 0.72rem;
}
.add-images-picker {
  padding: 12px;
  border: 1px dashed #9da9c4;
  border-radius: 10px;
  background: #f8f9fd;
}
.focal-controls {
  display: grid;
  gap: 12px;
}
.focal-controls label {
  gap: 5px;
}
input[type='range'] {
  width: 100%;
  min-height: 44px;
  margin: 0;
  touch-action: pan-y;
}
.focal-presets {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}
.focal-presets button {
  min-height: 40px;
  padding: 5px;
  background: #edf0f8;
  color: #2949c7;
  font-size: 0.78rem;
}
.focal-presets button:hover {
  background: #dfe5fa;
}

button,
.download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 0;
  border-radius: 10px;
  background: #3659db;
  color: #fff;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
}
button:hover,
.download:hover {
  background: #2949c7;
}
button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.result {
  min-height: 480px;
  overflow: hidden;
}
.result-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 22px;
  border-bottom: 1px solid #e6eaf2;
}
.result h2 {
  margin: 0 0 5px;
  font-size: 1.05rem;
}
#status {
  color: #758095;
  font-size: 0.88rem;
}
.download {
  min-height: 40px;
  padding: 8px 14px;
  white-space: nowrap;
}
.preview-stage {
  display: grid;
  min-height: 410px;
  place-items: center;
  padding: 22px;
  background: repeating-conic-gradient(#f3f5fa 0 25%, #fff 0 50%) 0 / 24px 24px;
}
#empty-preview {
  max-width: 260px;
  color: #8a94a8;
  text-align: center;
}
.composition {
  position: relative;
  width: fit-content;
  max-width: 100%;
  max-height: 68vh;
  line-height: 0;
  box-shadow: 0 8px 30px rgba(19, 30, 54, 0.16);
}
#preview {
  display: block;
  max-width: 100%;
  max-height: 68vh;
  object-fit: contain;
  visibility: hidden;
}
#preview-canvas,
.cell-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
#preview-canvas {
  z-index: 1;
  display: block;
  cursor: grab;
  touch-action: none;
}
#preview-canvas.dragging {
  cursor: grabbing;
}
.cell-overlay {
  z-index: 2;
  pointer-events: none;
}
.preview-cell {
  position: absolute;
  border: 2px solid transparent;
  pointer-events: none;
}
.preview-cell.selected {
  border-color: #6f8cff;
  box-shadow: inset 0 0 0 1px #fff;
}
.reorder-handle {
  position: absolute;
  top: 5px;
  right: 5px;
  min-width: 34px;
  min-height: 34px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 8px;
  background: rgba(20, 29, 48, 0.82);
  cursor: grab;
  pointer-events: auto;
  touch-action: none;
}
.reorder-handle:active,
.preview-cell.reordering .reorder-handle {
  cursor: grabbing;
  background: #2949c7;
}

.notice {
  margin-top: 20px;
  padding: 20px 22px;
  color: #667185;
  font-size: 0.88rem;
  line-height: 1.65;
  box-shadow: none;
}
.notice h2 {
  margin: 0 0 7px;
  color: #354057;
  font-size: 1rem;
}
.notice p {
  margin: 5px 0;
}

[hidden] {
  display: none !important;
}

@media (max-width: 760px) {
  .site-header,
  .header-inner {
    height: auto;
    min-height: 64px;
  }
  .header-inner {
    width: calc(100% - 32px);
    padding: 10px 0;
    flex-wrap: wrap;
    gap: 10px 16px;
  }
  .tool-nav {
    order: 3;
    flex-basis: 100%;
  }
  .ecosystem {
    margin-left: auto;
  }
  main {
    padding-top: 32px;
  }
  .workspace {
    grid-template-columns: 1fr;
  }
  .result {
    min-height: 360px;
  }
  .preview-stage {
    min-height: 290px;
  }
}

@media (max-width: 430px) {
  main {
    width: min(100% - 20px, 1120px);
  }
  .options {
    grid-template-columns: 1fr;
  }
  .result-heading {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* Shared i41 image-tools navigation and banner tokens. */
.header-inner {
  max-width: 1104px;
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
}
.brand span {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: #1769e0;
  color: white;
  font-size: 0.86rem;
}
.tool-nav {
  gap: 4px;
}
.tool-nav a {
  position: relative;
  padding: 8px 9px;
  border-radius: 8px;
  white-space: nowrap;
}
.tool-nav a[aria-current='page'] {
  color: white;
  background: #1769e0;
}
.tool-nav a.i-plan-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  padding-right: 15px;
  padding-left: 15px;
  text-align: center;
  color: white;
  background: #1769e0;
  font-weight: 800;
  border-radius: 9px;
}
.tool-nav a[aria-current='page'] {
  color: #1769e0;
  background: #edf5ff;
}

.privacy-badge {
  flex: none;
  padding: 6px 10px;
  border: 1px solid #b9e6ca;
  border-radius: 999px;
  background: #effbf3;
  color: #167143;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}
.i-plan-banner {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: min(1104px, calc(100% - 40px));
  margin: 16px auto 0;
  padding: 14px 18px;
  border: 1px solid #f1cf62;
  border-radius: 14px;
  background: linear-gradient(135deg, #fff9dd, #fff3ac);
  color: #5d4300;
  box-shadow: 0 12px 30px rgba(112, 82, 0, 0.1);
}
.i-plan-banner div {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.i-plan-banner strong {
  font-size: 1rem;
}
.i-plan-banner span {
  line-height: 1.45;
}
.i-plan-banner a {
  flex: none;
  padding: 9px 14px;
  border-radius: 999px;
  background: #172133;
  color: white;
  font-weight: 700;
  text-decoration: none;
}
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: fixed;
  top: 70px;
  left: 50%;
  z-index: 20;
  width: min(420px, calc(100vw - 32px));
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(20, 38, 48, 0.96);
  color: white;
  font-size: 0.84rem;
  line-height: 1.45;
  text-align: center;
  white-space: normal;
  opacity: 0;
  transform: translate(-50%, -4px);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}
[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
}
.footer-tagline {
  margin: 0;
  color: #25313d;
  text-align: center;
  font-weight: 800;
}
.notice details {
  margin-top: 10px;
}
.notice summary {
  cursor: pointer;
  color: #3156d9;
  text-align: center;
  font-weight: 700;
}
@media (max-width: 760px) {
  .privacy-badge {
    margin-left: auto;
  }
  .i-plan-banner {
    align-items: flex-start;
    flex-direction: column;
    width: calc(100% - 32px);
  }
  [data-tooltip]::after {
    position: fixed;
    top: auto;
    right: 16px;
    bottom: 16px;
    left: 16px;
    width: auto;
    transform: translateY(4px);
  }
  [data-tooltip]:hover::after,
  [data-tooltip]:focus-visible::after {
    transform: translateY(0);
  }
}
