:root {
  color-scheme: dark;
  --page: #000;
  --panel: #171719;
  --edge: #323235;
  --text: #f4f2ee;
  --muted: #adaaad;
  --gold: #f9bf64;
  font-family:
    ui-sans-serif,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Arial,
    sans-serif;
  background: var(--page);
  color: var(--text);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
a {
  touch-action: manipulation;
}
button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}
button:focus-visible,
a:focus-visible {
  outline: 3px solid #8ad2ed;
  outline-offset: 3px;
}
button:disabled {
  cursor: wait;
  opacity: 0.6;
}
header {
  border-bottom: 1px solid #27272a;
}
.bar {
  width: min(1192px, calc(100% - 80px));
  margin: auto;
}
.bar {
  height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-weight: 770;
  letter-spacing: -1.5px;
  font-size: 30px;
}
.brand img {
  width: 33px;
  height: 33px;
}
.help,
.add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: transparent;
  border: 1px solid var(--edge);
  border-radius: 9px;
  padding: 0 13px;
  min-height: 38px;
  font-size: 13px;
  font-weight: 600;
}
.help {
  border-color: transparent;
  color: #c5c2c2;
}
.help:hover,
.add:hover,
.slot:hover {
  background: #303033;
}
i {
  display: inline-flex;
}
svg {
  display: block;
  width: 18px;
  height: 18px;
}
html {
  --preview-height: min(380px, 42svh);
  scroll-padding-top: calc(var(--preview-height) + 12px);
}
.brand-heading {
  margin: 0;
}
main {
  padding-bottom: 32px;
}
@media (min-width: 801px) {
  .settings {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 36px;
  }
  .settings .section-title {
    grid-column: 1 / -1;
  }
  .settings .group:nth-last-child(2) {
    border-bottom: 0;
  }
  .export {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    gap: 8px;
  }
  .photos .export #share {
    margin-top: 0;
  }
  .export small {
    grid-column: 1 / -1;
  }
}
.editor {
  width: min(1000px, calc(100% - 80px));
  margin: 22px auto 0;
  display: grid;
  align-items: start;
  gap: 18px;
}
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 40px;
}
.section-title h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 17px;
  letter-spacing: -0.45px;
  font-weight: 650;
}
.section-title h2 i {
  color: #c3beb9;
}
.mat {
  position: sticky;
  top: 0;
  z-index: 1;
  isolation: isolate;
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  place-items: center;
  height: var(--preview-height);
  background-color: #343d3b;
  background-image:
    linear-gradient(#c2dcc214 1px, transparent 1px),
    linear-gradient(90deg, #c2dcc214 1px, transparent 1px),
    radial-gradient(ellipse at 45% 30%, #47514d, transparent 80%);
  background-size:
    22px 22px,
    22px 22px,
    auto;
  overflow: hidden;
}
.print {
  position: relative;
  display: block;
  width: auto;
  height: 82%;
  box-shadow: 2px 9px 14px #13171377;
}
#canvas {
  display: block;
  height: 100%;
  width: auto;
}
#preview-photos {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.preview-photo {
  position: absolute;
  background: transparent;
  border: 0;
  padding: 0;
  pointer-events: auto;
}
.preview-photo:focus-visible {
  outline: 3px solid white;
  outline-offset: -4px;
}
@media (hover: hover) {
  .preview-photo:hover {
    box-shadow: inset 0 0 0 2px #fffd;
  }
}
.settings .section-title {
  border-bottom: 1px solid var(--edge);
}
.group {
  padding: 21px 0;
  border-bottom: 1px solid var(--edge);
}
h3 {
  font-size: 15px;
  margin: 0 0 12px;
  font-weight: 650;
}
.options {
  display: grid;
  gap: 7px;
}
.layouts {
  grid-template-columns: repeat(4, 1fr);
}
.shapes,
.frames {
  grid-template-columns: repeat(3, 1fr);
}
.choice {
  background: #202023;
  border: 1px solid #3a3a3f;
  border-radius: 9px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 72px;
  font-size: 12px;
  font-weight: 550;
  color: #c7c4c4;
}
.choice:hover {
  background: #2a2a2c;
}
.choice[aria-pressed="true"] {
  border-color: var(--gold);
  color: var(--gold);
  background: #302a20;
  box-shadow: inset 0 0 0 0.35px var(--gold);
}
.mini {
  display: grid;
  width: 32px;
  height: 24px;
  gap: 2px;
  grid-template-columns: repeat(2, 1fr);
}
.mini b {
  background: currentColor;
  opacity: 0.8;
  border-radius: 1px;
}
.mini.n3 b:first-child {
  grid-row: span 2;
}
.mini.n6 {
  grid-template-columns: repeat(3, 1fr);
}
.frames .choice {
  height: 70px;
}
.frame-icon {
  width: 37px;
  height: 26px;
  border: 2px solid;
  display: block;
  position: relative;
}
.frame-icon::before {
  content: "";
  position: absolute;
  inset: 3px;
  background: currentColor;
  opacity: 0.65;
}
.frame-icon.print {
  border-bottom-width: 6px;
  transform: rotate(-6deg);
}
.frame-icon.film {
  border-top: 4px dotted;
  border-bottom: 4px dotted;
}
.colors h3 {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
small {
  font-size: 12px;
  color: var(--muted);
  font-weight: normal;
}
#swatches {
  display: flex;
  justify-content: space-between;
  max-width: 320px;
}
.swatch {
  width: 40px;
  height: 44px;
  border: 0;
  background: none;
  display: grid;
  place-content: center;
  position: relative;
}
.swatch::before {
  content: "";
  width: 29px;
  height: 29px;
  background: var(--color);
  border: 1px solid #ffffff4a;
  border-radius: 100%;
}
.swatch[aria-pressed="true"]::before {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}
.swatch[aria-pressed="true"]::after {
  content: "✓";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 17px;
  color: #222;
}
.swatch:first-child::after {
  color: #fff;
}
.export {
  margin-top: 16px;
  border-top: 1px solid var(--edge);
  padding-top: 16px;
  text-align: center;
}
.export button,
dialog button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  border: 0;
  background: var(--gold);
  color: #211c16;
  border-radius: 9px;
  height: 46px;
  font-weight: 700;
  font-size: 15px;
}
.export button:hover,
dialog button:hover {
  background: #ffd18b;
}
.export small {
  display: block;
  margin-top: 9px;
  font-size: 11px;
}
.group:last-child {
  border-bottom: none;
}
.photos .section-title {
  min-height: 52px;
}
.add {
  font-size: 12px;
  background: #252528;
  min-height: 34px;
}
.add svg {
  width: 15px;
}
.photos small {
  display: block;
  margin-top: 9px;
}
#slots {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.slot {
  width: 64px;
  height: 53px;
  position: relative;
  overflow: hidden;
  border: 1px solid #57575a;
  border-radius: 6px;
  padding: 0;
  background: #222225;
  color: #bbb;
}
.slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.slot span {
  position: absolute;
  bottom: 3px;
  left: 3px;
  background: #171719d9;
  color: white;
  border-radius: 3px;
  min-width: 14px;
  font: 10px/15px monospace;
}
#message {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  background: #f3e8d8;
  color: #231f19;
  border-radius: 9px;
  box-shadow: 0 4px 20px #0005;
  padding: 12px 18px;
  margin: 0;
  z-index: 3;
  width: max-content;
  max-width: 90vw;
}
#message:empty {
  display: none;
}
dialog {
  max-width: min(390px, 90vw);
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--edge);
  border-radius: 16px;
  padding: 24px;
}
dialog::backdrop {
  background: #000a;
}
dialog h2 {
  margin: 0;
}
dialog ol {
  padding-left: 22px;
}
dialog li {
  padding: 5px;
  line-height: 1.5;
}
dialog p {
  color: var(--muted);
  font-size: 14px;
}
@media (max-width: 800px) {
  .bar,
  .editor {
    width: min(610px, calc(100% - 32px));
  }
  .bar {
    height: 60px;
  }
  .brand {
    font-size: 26px;
  }
  .brand img {
    width: 29px;
    height: 29px;
  }
  html {
    --preview-height: min(55vw, 30svh);
  }
  .editor {
    grid-template-columns: 1fr;
    margin: 14px auto 0;
    gap: 14px;
  }
  .section-title {
    min-height: 40px;
  }
  .group {
    padding: 16px 0;
  }

  .help,
  .add {
    min-height: 44px;
  }
  .photos .section-title {
    min-height: 58px;
  }
  .swatch {
    width: 44px;
  }
  .slot {
    width: clamp(44px, 12vw, 64px);
  }
}

.motif {
  height: 26px;
  line-height: 26px;
  font:
    26px/26px Georgia,
    serif;
}
.export #share,
dialog #install {
  background: #242426;
  color: var(--text);
  border: 1px solid #474749;
  margin-top: 8px;
}
dialog #install {
  margin-bottom: 10px;
}
dialog [hidden] {
  display: none !important;
}

.shape-icon {
  display: inline-block;
  height: 22px;
  aspect-ratio: 4 / 3;
  border: 2px solid currentColor;
  border-radius: 3px;
}
.shape-icon[data-shape="Square"] {
  aspect-ratio: 1;
}
.shape-icon[data-shape="Portrait"] {
  aspect-ratio: 3 / 4;
}

.preview-tools {
  display: grid;
  gap: 4px;
  position: absolute;
  top: 10px;
  right: max(10px, env(safe-area-inset-right));
  z-index: 1;
}
.preview-tools .add,
#close-preview {
  width: 44px;
  min-height: 44px;
  padding: 0;
  box-shadow: 0 2px 6px #0004;
}
#add-text b {
  font:
    bold 19px Georgia,
    serif;
  color: var(--gold);
}
.caption-handle {
  position: absolute;
  transform: translate(-50%, -50%);
  background: transparent;
  border: 0;
  padding: 0;
  min-width: 24px;
  min-height: 24px;
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.caption-handle:active {
  cursor: grabbing;
}
.caption-handle:focus-visible {
  outline: 2px dashed white;
}
#text-editor {
  width: min(360px, 90vw);
}
#text-editor label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 18px 0 7px;
  font-weight: 600;
  font-size: 14px;
}
#caption {
  width: 100%;
  border: 1px solid var(--edge);
  border-radius: 8px;
  padding: 12px;
  background: #242426;
  color: var(--text);
  font: inherit;
  font-size: 16px;
}
#text-color {
  width: 64px;
  height: 44px;
  border: 1px solid var(--edge);
  background: #242426;
  border-radius: 8px;
  cursor: pointer;
}
.text-actions {
  display: flex;
  gap: 8px;
}
.text-actions button[type="button"] {
  background: #29292c;
  color: var(--text);
}

#expanded-preview {
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: black;
}
#preview-screen {
  position: relative;
  width: 100%;
  height: 100%;
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  place-items: center;
  background: black;
}
#full-canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
}
#close-preview {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  right: max(10px, env(safe-area-inset-right));
  color: white;
  background: #252528;
  font: 26px/1 sans-serif;
}
html:has(#expanded-preview[open]) {
  overflow: hidden;
}

@media (orientation: landscape) and (max-height: 420px) {
  .preview-tools {
    grid-auto-flow: column;
  }
}
