: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 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 40px;
  padding: 2px 2px 8px;
}

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

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

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

.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-project {
  --section-accent: #0f6f78;
  --section-bg: #edf7f8;
}

.sidebar .section-canvas {
  --section-accent: #496f9b;
  --section-bg: #f0f5fb;
}

.sidebar .section-images {
  --section-accent: #668052;
  --section-bg: #f2f7ef;
}

.sidebar .section-build-actions {
  --section-accent: #0f6f78;
  --section-bg: #edf8f6;
}

.sidebar .section-export {
  --section-accent: #405f74;
  --section-bg: #f0f5f8;
}

.sidebar .section-about {
  --section-accent: #5f6670;
  --section-bg: #f4f5f7;
}

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

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;
}

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

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

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

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;
  align-items: stretch;
}

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

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

.check input {
  width: auto;
}

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

.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;
}

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

.upgrade-banner {
  --upgrade-accent: #0f6f78;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 76px;
  padding: 12px 18px;
  border-top: 1px solid #c8cdd3;
  border-left: 5px solid var(--upgrade-accent);
  background: #f7fbfb;
  color: #20242a;
  text-decoration: none;
}

.upgrade-banner:hover {
  background: #ffffff;
}

.upgrade-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.upgrade-kicker {
  color: var(--upgrade-accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

#upgradeProduct {
  font-size: 16px;
  line-height: 1.2;
}

#upgradeDescription {
  color: #56616d;
  font-size: 13px;
  line-height: 1.3;
}

.upgrade-action {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 9px 13px;
  border: 1px solid var(--upgrade-accent);
  border-radius: 6px;
  background: var(--upgrade-accent);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
}

.stage {
  position: relative;
  width: fit-content;
  height: fit-content;
  margin: 0 auto;
  box-shadow: 0 12px 32px rgba(24, 31, 40, 0.22);
  background: #fff;
}

canvas {
  display: block;
  background: #fff;
  cursor: default;
}

.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;
}

.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;
}

.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;
}

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

.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;
    grid-template-rows: 52px 1fr auto;
  }

  .upgrade-banner {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
    padding: 10px;
  }

  .upgrade-action {
    width: 100%;
    text-align: center;
  }
}
