:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #d9dde2;
  color: #20242a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 312px 1fr;
  overflow: hidden;
}

.sidebar {
  height: 100vh;
  overflow: auto;
  background: #e9edf1;
  border-right: 1px solid #c8cdd3;
  padding: 10px;
  font-size: 13px;
}

.brand h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1.15;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 40px;
  padding: 2px 2px 8px;
}

.icon-button {
  width: 32px;
  min-width: 32px;
  min-height: 32px;
  padding: 0;
  border-radius: 50%;
  font-weight: 700;
}

.brand p,
.summary {
  color: #65707d;
  font-size: 12px;
  line-height: 1.28;
}

#pixelSummary {
  margin: -2px 0 8px;
}

#pageDetail {
  margin-top: 5px;
}

#licenseSummary {
  margin-top: 6px;
}

.canvas-actions {
  margin-bottom: 9px;
}

.spotlight-note {
  margin: -3px 0 7px 28px;
}

.qr-note {
  margin: -3px 0 7px;
}

.sidebar section {
  --section-accent: #6d7885;
  --section-bg: #f5f7f9;
  margin-top: 8px;
  padding: 9px 9px 10px 10px;
  border: 1px solid #d2d8df;
  border-left: 4px solid var(--section-accent);
  border-radius: 8px;
  background: var(--section-bg);
}

.sidebar section:nth-of-type(1) {
  --section-accent: #0f6f78;
  --section-bg: #edf7f8;
}

.sidebar section:nth-of-type(2) {
  --section-accent: #496f9b;
  --section-bg: #f0f5fb;
}

.sidebar section:nth-of-type(3) {
  --section-accent: #668052;
  --section-bg: #f2f7ef;
}

.sidebar section:nth-of-type(4) {
  --section-accent: #8a6a2d;
  --section-bg: #faf6ec;
}

.sidebar section:nth-of-type(5) {
  --section-accent: #7b5a88;
  --section-bg: #f7f1fa;
}

.sidebar section:nth-of-type(6) {
  --section-accent: #a56142;
  --section-bg: #fbf2ec;
}

.sidebar section:nth-of-type(7) {
  --section-accent: #5d728a;
  --section-bg: #f1f5f8;
}

.sidebar section:nth-of-type(8) {
  --section-accent: #0f6f78;
  --section-bg: #edf8f6;
}

.sidebar section:nth-of-type(9) {
  --section-accent: #596574;
  --section-bg: #f3f5f7;
}

.sidebar section:nth-of-type(10) {
  --section-accent: #766c52;
  --section-bg: #f6f4ee;
}

.sidebar section:nth-of-type(11) {
  --section-accent: #405f74;
  --section-bg: #f0f5f8;
}

.sidebar section:nth-of-type(12) {
  --section-accent: #5f6670;
  --section-bg: #f4f5f7;
}

h2 {
  margin: 0 0 7px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
  color: #3f4853;
}

.section-subhead {
  margin: 2px 0 8px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
  color: #596574;
}

label {
  display: grid;
  gap: 4px;
  margin-bottom: 6px;
  font-size: 13px;
  color: #3e4650;
}

input,
select,
button,
.button {
  border: 1px solid #b9c0c8;
  border-radius: 6px;
  background: #fff;
  color: #20242a;
  font: inherit;
  font-size: 13px;
  min-height: 30px;
}

input,
select {
  width: 100%;
  padding: 4px 8px;
}

textarea {
  width: 100%;
  min-height: 76px;
  padding: 7px 8px;
  border: 1px solid #b9c0c8;
  border-radius: 6px;
  background: #fff;
  color: #20242a;
  font: inherit;
  resize: vertical;
}

button,
.button {
  padding: 5px 9px;
  cursor: pointer;
  text-align: center;
  user-select: none;
}

button:hover,
.button:hover {
  border-color: #7c8794;
}

.primary-button {
  background: #0f6f78;
  border-color: #0f6f78;
  color: #fff;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.button input {
  display: none;
}

.button-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.button-row > label {
  margin-bottom: 0;
}

.project-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: stretch;
}

.project-actions button,
.project-actions .button {
  width: 100%;
}

.preset-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  align-items: end;
  margin-bottom: 6px;
}

.preset-row label {
  margin-bottom: 0;
}

#flipCanvasBtn {
  min-width: 56px;
}

.page-order-actions {
  margin-top: 6px;
}

.page-order-actions button {
  flex: 1 1 calc(50% - 4px);
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.designer-area {
  margin: 5px 0 7px;
  padding: 8px;
  border: 1px solid #d1d6dc;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.46);
}

.check {
  display: flex;
  gap: 8px;
  align-items: center;
}

.check input {
  width: auto;
}

.page-list {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.page-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 5px 7px;
  border: 1px solid #d1d6dc;
  border-radius: 6px;
  background: #fff;
  font-size: 13px;
}

.page-item.active {
  border-color: #596574;
  background: #eef1f4;
}

.page-item input {
  width: auto;
  min-height: auto;
}

.page-jump {
  min-height: 26px;
  padding: 3px 8px;
}

.workspace {
  min-width: 0;
  height: 100vh;
  display: grid;
  grid-template-rows: 52px 1fr;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 9px 14px;
  background: #eceff2;
  border-bottom: 1px solid #c8cdd3;
}

#status {
  min-width: 0;
  flex: 1;
  color: #48525f;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.zoom-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.zoom-controls button {
  min-width: 34px;
  min-height: 30px;
  padding: 4px 9px;
}

.zoom-level {
  min-width: 54px;
  min-height: 30px;
  display: grid;
  place-items: center;
  padding: 4px 8px;
  border: 1px solid #b9c0c8;
  border-radius: 6px;
  background: #fff;
  color: #303843;
  font-size: 13px;
}

.stage-wrap {
  overflow: auto;
  padding: 32px 32px 104px;
}

.stage {
  position: relative;
  width: fit-content;
  height: fit-content;
  margin: 0 auto;
}

canvas {
  position: absolute;
  display: block;
  background: transparent;
  background-image:
    linear-gradient(45deg, #c5cad0 25%, transparent 25%),
    linear-gradient(-45deg, #c5cad0 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #c5cad0 75%),
    linear-gradient(-45deg, transparent 75%, #c5cad0 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  box-shadow: 0 12px 32px rgba(24, 31, 40, 0.22);
  cursor: default;
}

.manual-text-layer {
  position: absolute;
  overflow: visible;
  pointer-events: none;
  z-index: 4;
}

.manual-text-display {
  position: absolute;
  overflow: hidden;
  transform-origin: center center;
  pointer-events: auto;
  cursor: text;
  user-select: none;
}

.manual-text-fill,
.manual-text-stroke,
.manual-text-content {
  position: absolute;
  inset: 0;
}

.manual-text-stroke {
  border-style: solid;
  pointer-events: none;
}

.manual-text-content {
  overflow: hidden;
  white-space: pre-wrap;
  pointer-events: none;
}

.selection {
  position: absolute;
  pointer-events: none;
  outline: 2px solid #15191f;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.95);
  z-index: 5;
}

.transform-handle {
  --handle-bg: rgba(15, 111, 120, 0.96);
  --handle-rotation: 0rad;
  position: absolute;
  width: 30px;
  min-width: 30px;
  min-height: 30px;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 6px;
  background-color: var(--handle-bg);
  background-position: center;
  background-repeat: no-repeat;
  background-size: 20px 20px;
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.3);
  transform-origin: center center;
  transform: translate(-50%, -50%) rotate(var(--handle-rotation));
  will-change: transform;
  z-index: 7;
}

.move-handle {
  cursor: grab;
  background-size: 22px 22px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.1' stroke-linecap='round'%3E%3Cpath d='M12 4.5v15M4.5 12h15'/%3E%3Cpath fill='white' stroke='none' d='M12 2.5l2.6 3.4H9.4zM12 21.5l-2.6-3.4h5.2zM2.5 12l3.4-2.6v5.2zM21.5 12l-3.4 2.6V9.4z'/%3E%3C/svg%3E");
}

.move-handle:active,
.rotate-handle:active {
  cursor: grabbing;
}

.duplicate-handle {
  background-image: none;
}

.duplicate-handle::before,
.duplicate-handle::after {
  content: "";
  position: absolute;
  width: 9px;
  height: 9px;
  border: 2.6px solid #fff;
  border-radius: 4px;
}

.duplicate-handle::before {
  left: 9.4px;
  top: 6px;
}

.duplicate-handle::after {
  left: 5.9px;
  top: 9.5px;
  background: var(--handle-bg);
}

.rotate-handle {
  cursor: grab;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 12a9 9 0 1 1-3-6.7'/%3E%3Cpath d='M21 3v6h-6'/%3E%3C/svg%3E");
}

.delete-handle {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6h18'/%3E%3Cpath d='M8 6V4h8v2'/%3E%3Cpath d='M6 6l1 15h10l1-15'/%3E%3Cpath d='M10 11v6M14 11v6'/%3E%3C/svg%3E");
}

.resize-handle {
  width: 26px;
  min-width: 26px;
  min-height: 26px;
  cursor: nwse-resize;
}

.resize-handle::before {
  content: "";
  position: absolute;
  right: 5px;
  bottom: 5px;
  width: 11px;
  height: 11px;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
}

.collage-reshuffle-btn {
  position: absolute;
  min-height: 30px;
  padding: 5px 12px;
  border: 2px solid #fff;
  border-radius: 7px;
  background: rgba(15, 111, 120, 0.96);
  color: #fff;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.3);
  transform: translate(-50%, 0);
  z-index: 7;
}

.collage-reshuffle-btn:hover {
  border-color: #fff;
  background: rgba(12, 93, 101, 0.98);
}

.frame-control {
  position: absolute;
  display: grid;
  grid-template-columns: minmax(130px, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 7px;
  background: rgba(28, 32, 38, 0.92);
  border-radius: 7px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28);
  z-index: 3;
}

.frame-control input {
  min-height: 24px;
  padding: 0;
}

.frame-control button {
  min-height: 28px;
  padding: 4px 8px;
}

.text-editor {
  position: absolute;
  z-index: 5;
  display: block;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  outline: 0;
  resize: none;
  overflow: hidden;
  clip-path: inset(0);
  line-height: 1.25;
}

.text-control {
  position: fixed;
  left: 336px;
  right: 16px;
  bottom: 16px;
  z-index: 6;
  display: grid;
  grid-template-columns: minmax(130px, 1fr) 58px 76px 76px 34px auto 34px 58px auto 34px 52px auto auto 34px;
  gap: 5px;
  align-items: center;
  width: auto;
  padding: 5px;
  background: rgba(28, 32, 38, 0.92);
  border-radius: 7px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28);
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
}

.text-control select,
.text-control input {
  min-width: 0;
  min-height: 26px;
  padding: 2px 5px;
  font-size: 12px;
}

.text-control input[type="color"] {
  padding: 1px;
}

.text-control button {
  min-height: 26px;
  padding: 2px 7px;
  font-size: 12px;
  white-space: nowrap;
}

.text-control .fx-button {
  min-width: 34px;
  padding: 2px 0;
  font-size: 15px;
  font-style: italic;
}

.text-effects-panel {
  position: fixed;
  right: 16px;
  bottom: 58px;
  z-index: 8;
  width: min(620px, calc(100vw - 352px));
  max-height: min(560px, calc(100vh - 88px));
  overflow: auto;
  padding: 10px;
  border-radius: 7px;
  background: rgba(28, 32, 38, 0.96);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.32);
  color: #fff;
}

.effects-panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.effects-panel-heading strong {
  font-size: 13px;
}

.effects-panel-heading .icon-button {
  width: 26px;
  min-width: 26px;
  min-height: 26px;
  border-color: #6d7784;
  background: #fff;
  color: #20242a;
}

.effects-section {
  display: grid;
  gap: 7px;
  padding: 8px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.effects-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(70px, 1fr));
  gap: 6px;
}

.effects-grid label {
  margin-bottom: 0;
  color: #dfe5eb;
  font-size: 12px;
}

.effects-grid input,
.effects-grid select {
  min-height: 26px;
  padding: 2px 5px;
  font-size: 12px;
}

.effects-grid input[type="color"] {
  padding: 1px;
}

.mini-check {
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 26px;
  margin: 0;
  padding: 2px 5px;
  border: 1px solid #b9c0c8;
  border-radius: 6px;
  background: #fff;
  color: #20242a;
  font-size: 12px;
  white-space: nowrap;
}

.mini-check input {
  width: auto;
  min-height: auto;
  margin: 0;
  padding: 0;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(25, 30, 36, 0.42);
}

.modal {
  width: min(440px, 100%);
  padding: 22px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #c6ccd3;
  box-shadow: 0 18px 50px rgba(15, 20, 28, 0.28);
}

.modal h2 {
  margin-bottom: 8px;
  font-size: 18px;
  text-transform: none;
  color: #20242a;
}

.modal p,
.modal li {
  margin: 0;
  color: #48525f;
  line-height: 1.45;
}

.modal-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.modal-heading h2 {
  margin: 0;
}

.help-modal {
  width: min(620px, 100%);
  max-height: min(760px, calc(100vh - 48px));
  overflow: auto;
}

.license-modal {
  width: min(520px, 100%);
}

.hero-modal {
  width: min(760px, 100%);
  max-height: min(780px, calc(100vh - 48px));
  overflow: auto;
}

.hero-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 10px;
  max-height: 560px;
  overflow: auto;
  padding: 8px;
  border: 1px solid #d1d6dc;
  border-radius: 7px;
  background: #f8f9fa;
}

.hero-choice {
  display: grid;
  gap: 7px;
  padding: 7px;
  min-height: auto;
  text-align: left;
  background: #fff;
}

.hero-choice.selected {
  border-color: #0f6f78;
  box-shadow: 0 0 0 2px rgba(15, 111, 120, 0.2);
}

.hero-choice img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 4px;
  background: #dfe3e8;
}

.hero-choice span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  color: #3e4650;
}

.license-actions {
  margin: 18px 0 10px;
}

.license-details {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid #d1d6dc;
  border-radius: 7px;
  background: #f8f9fa;
  color: #48525f;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-line;
}

.help-modal h3 {
  margin: 18px 0 7px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0;
  color: #4d5661;
}

.help-modal ol,
.help-modal ul {
  margin: 0;
  padding-left: 22px;
}

.help-modal li + li {
  margin-top: 5px;
}

.export-modal {
  width: min(620px, 100%);
  max-height: min(780px, calc(100vh - 48px));
  overflow: auto;
}

.export-page-picker {
  display: grid;
  gap: 7px;
  max-height: 220px;
  overflow: auto;
  margin-top: 12px;
  padding: 8px;
  border: 1px solid #d1d6dc;
  border-radius: 7px;
  background: #f8f9fa;
}

.export-page-row {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px;
  padding: 5px 6px;
  border-radius: 6px;
  background: #fff;
  font-size: 13px;
}

.export-page-row input {
  width: auto;
  min-height: auto;
}

#exportSummary {
  margin-top: 10px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

.modal .danger {
  background: #7f1d1d;
  border-color: #7f1d1d;
  color: #fff;
}

.modal .primary {
  background: #0f6f78;
  border-color: #0f6f78;
  color: #fff;
}

.busy-box {
  min-width: 220px;
  display: grid;
  gap: 12px;
  justify-items: center;
  padding: 24px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #c6ccd3;
  box-shadow: 0 18px 50px rgba(15, 20, 28, 0.28);
  color: #20242a;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid #cfd6dd;
  border-top-color: #0f6f78;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.hidden {
  display: none;
}

@media (max-width: 860px) {
  body {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    overflow: auto;
  }

  .sidebar {
    height: auto;
    max-height: 48vh;
    border-right: 0;
    border-bottom: 1px solid #c8cdd3;
  }

  .workspace {
    height: 52vh;
  }

  .text-control {
    left: 12px;
    right: 12px;
    bottom: 12px;
    grid-template-columns: 132px 58px 76px 76px 34px auto 34px 58px auto 34px 52px auto auto 34px;
  }

  .text-effects-panel {
    left: 12px;
    right: 12px;
    bottom: 54px;
    width: auto;
  }

  .effects-grid {
    grid-template-columns: repeat(2, minmax(90px, 1fr));
  }
}
