@font-face{font-family:'Luckiest Guy';src:url('fonts/LuckiestGuy-Regular.ttf') format('truetype');font-display:swap}
@font-face{font-family:Roboto;src:url('fonts/Roboto.ttf') format('truetype');font-weight:100 900;font-display:swap}
@font-face{font-family:'Open Sans';src:url('fonts/OpenSans.ttf') format('truetype');font-weight:300 800;font-display:swap}
@font-face{font-family:Lato;src:url('fonts/Lato.ttf') format('truetype');font-weight:400;font-display:swap}
@font-face{font-family:Poppins;src:url('fonts/Poppins.ttf') format('truetype');font-weight:400;font-display:swap}

:root {
  color-scheme: dark;
  font: 14px 'Segoe UI', Arial, sans-serif;
  color: #f1f4f5;
  background: #111315;
  --accent: #37dad2;
  --accent-ink: #88f0e9;
  --red: #ff5577;
  --muted: #a4afb5;
  --line: #333a3f;
  --panel: #1a1e22;
}
* { box-sizing: border-box; letter-spacing: 0; }
body { margin: 0; min-width: 280px; }
button, input, select { font: inherit; }
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid #414a50;
  border-radius: 5px;
  background: #252b30;
  color: #e8edef;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
button:hover { border-color: #73858d; background: #30383e; }
button:active { background: #1c2428; }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { background: var(--accent); color: #092826; border-color: var(--accent); }
button.primary:hover { background: #7aece4; border-color: #7aece4; }
button.danger { color: #ff9aaf; }
button.danger:hover { border-color: #a84b60; background: #3a242b; color: #ffd3dd; }
button.icon { width: 36px; height: 36px; padding: 7px; flex: none; }
svg { width: 17px; height: 17px; flex: none; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
input, select {
  width: 100%;
  min-width: 0;
  height: 36px;
  border: 1px solid #434d54;
  border-radius: 5px;
  padding: 7px 10px;
  background: #14181b;
  color: #f1f4f5;
  font-size: 12px;
}
input::placeholder { color: #939fa7; opacity: 1; }
input:hover, select:hover { border-color: #63747d; }
input:focus, select:focus { border-color: var(--accent); outline: 2px solid #37dad238; outline-offset: 1px; }
select option { background: #1a1e22; color: #f1f4f5; }
select option:checked { background: #28514f; color: #ffffff; }
input[type=color] { width: 36px; height: 30px; padding: 3px; cursor: pointer; }
input[type=color]::-webkit-color-swatch-wrapper { padding: 1px; }
input[type=color]::-webkit-color-swatch { border: 1px solid #ffffff40; border-radius: 2px; }
input[type=checkbox] { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); cursor: pointer; }
label { display: flex; flex-direction: column; gap: 7px; color: #bcc7cd; font-size: 12px; line-height: 1.4; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 23px; font-weight: 650; line-height: 1.3; overflow-wrap: anywhere; }
h2 { font-size: 14px; font-weight: 650; }
h3 { font-size: 13px; }
[hidden] { display: none !important; }
* { scrollbar-width: thin; scrollbar-color: #526168 #171b1e; }

.appbar {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 12px 26px;
  background: #191d20;
  border-bottom: 1px solid #373e43;
  box-shadow: 0 4px 16px #00000018;
}
.brand { display: flex; align-items: baseline; flex: none; color: #fff; text-decoration: none; font-size: 31px; font-weight: 900; line-height: 1; }
.brand-m { color: #37c9ed; }
.brand-n { -webkit-text-stroke: 1px #a7b5bc; color: #121619; }
.brand-g { color: #ff3f68; }
.brand small { margin-left: 5px; font-size: 12px; }
.app-title { padding-left: 22px; border-left: 1px solid #41494f; color: #c0cbd0; font-size: 13px; }
.appbar nav { display: flex; align-items: center; gap: 8px; margin-left: auto; }
#newBtn { color: var(--accent-ink); border-color: #3b6b69; background: #203331; }
#newBtn:hover { background: #294440; border-color: var(--accent); }
#closeDesigner { margin-left: 4px; background: transparent; }
main { max-width: 1800px; margin: auto; padding: 23px 26px 112px; }
.editor-heading { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 24px; }
.editor-heading > div { min-width: 0; }
.eyebrow { display: block; margin-bottom: 5px; color: var(--accent-ink); font-size: 10px; font-weight: 600; }
#saveState { display: flex; align-items: center; gap: 7px; color: #b9c7ca; font-size: 11px; line-height: 1.5; text-align: right; }
#saveState:empty { display: none; }
#saveState::before { content: ''; width: 6px; height: 6px; flex: none; border-radius: 2px; background: var(--accent); }
#saveState[data-state=dirty] { color: #f2c4a4; }
#saveState[data-state=dirty]::before { background: #f4b47d; }
.editor-layout { display: grid; grid-template-columns: 336px minmax(0,1fr); gap: 24px; align-items: start; }
.gift-panel { min-width: 0; padding-right: 22px; border-right: 1px solid var(--line); }
.panel-heading { display: flex; align-items: center; gap: 8px; margin-bottom: 18px; }
.panel-heading > svg { color: var(--accent); width: 16px; height: 16px; }
.panel-heading h2 { font-size: 13px; color: #d5dfe3; }
.zones { display: grid; gap: 18px; }
.zone { min-width: 0; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.zone:last-child { border-bottom: 0; }
.zone-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.zone-header h2 { display: flex; align-items: center; gap: 7px; font-size: 12px; color: #d8e1e5; }
.zone-header h2 svg { width: 15px; height: 15px; color: var(--accent); }
.zone[data-zone=right] .zone-header h2 svg { color: #ff8ca4; }
.zone-header small { color: var(--muted); font-size: 10px; white-space: nowrap; }
.zone-list { display: grid; gap: 8px; }
.zone-empty { padding: 22px 10px; border: 1px dashed #3d474e; border-radius: 5px; text-align: center; font-size: 12px; color: var(--muted); }
.zone-add { width: 100%; margin-top: 9px; min-height: 34px; background: #1a2b2b; border-color: #365754; color: var(--accent-ink); font-size: 12px; }
.zone-add:hover { border-color: var(--accent); background: #233b38; }
.zone-add svg { width: 15px; height: 15px; }
.zone-item { min-width: 0; padding: 10px; border: 1px solid #3b444b; border-radius: 6px; background: #1d2327; transition: border-color .15s, background .15s; }
.zone-item:hover { border-color: #607078; }
.zone-item:focus-within { border-color: var(--accent); background: #202c2e; box-shadow: inset 2px 0 var(--accent); }
.zone-item.dragging { opacity: .4; }
.item-head { display: flex; align-items: center; gap: 3px; min-height: 40px; margin-bottom: 8px; }
.gift-pick { justify-content: flex-start; flex: 1; min-width: 0; min-height: 40px; padding: 0 3px; gap: 7px; border-color: transparent; background: transparent; text-align: left; }
.gift-pick:hover { background: transparent; border-color: transparent; color: var(--accent-ink); }
.gift-pick img { width: 36px; height: 36px; object-fit: contain; filter: drop-shadow(0 2px 3px #0005); }
.gift-pick span { min-width: 0; }
.gift-pick b { display: block; font-size: 12px; font-weight: 600; overflow-wrap: anywhere; }
.gift-pick small { display: block; margin-top: 3px; font-size: 10px; color: #ddc590; font-weight: 400; }
.item-head .icon { width: 25px; height: 30px; min-height: 30px; padding: 4px; border-color: transparent; background: transparent; color: #b6c4cc; }
.item-head .icon:hover { background: #334147; border-color: #63747d; color: #fff; }
.item-head .icon.danger { color: #ff91a9; }
.item-head .icon.danger:hover { background: #442a32; border-color: #a75569; }
.item-head .icon svg { width: 14px; height: 14px; }
.item-head .drag-handle { width: 15px; padding: 0; color: #8b9da6; cursor: grab; }
.caption-row { display: grid; grid-template-columns: minmax(0,1fr) 30px 30px; gap: 5px; margin-top: 6px; }
.caption-row input { height: 32px; padding: 6px 8px; font-size: 12px; }
.caption-row .icon { width: 30px; height: 32px; min-height: 32px; padding: 6px; background: #262f34; border-color: #46535c; color: #c0d1d9; }
.caption-row .icon:hover { background: #304b49; border-color: var(--accent); color: var(--accent-ink); }
.caption-row .icon svg { width: 14px; height: 14px; }

.design-workspace { min-width: 0; }
.preview-section > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.preview-section h2 { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.preview-section h2 svg { width: 16px; height: 16px; color: var(--muted); }
.live-indicator { display: inline-flex; align-items: center; gap: 6px; color: var(--accent-ink); font-size: 10px; font-weight: 600; }
.live-indicator::before { content: ''; width: 6px; height: 6px; border-radius: 2px; background: var(--accent); }
.preview-checker {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: clamp(240px,36vh,440px);
  padding: 18px;
  overflow: hidden;
  border: 1px solid #4c5b62;
  border-radius: 6px;
  background: #161b1f;
  box-shadow: inset 0 0 24px #0003;
}
canvas {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  min-width: 0;
  flex: none;
  background-color: #21272b;
  background-image: linear-gradient(45deg,#293035 25%,transparent 25%), linear-gradient(-45deg,#293035 25%,transparent 25%), linear-gradient(45deg,transparent 75%,#293035 75%), linear-gradient(-45deg,transparent 75%,#293035 75%);
  background-size: 20px 20px;
  background-position: 0 0,0 10px,10px -10px,-10px 0;
  box-shadow: 0 0 0 1px #56666d, 0 5px 14px #0004;
}
#emptyPreview { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 12px; padding: 20px; color: #c1cdd3; font-size: 12px; pointer-events: none; }
#emptyPreview svg { width: 30px; height: 30px; color: #8dabb6; stroke-width: 1.4; }
.preview-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 9px; font-size: 10px; color: var(--muted); }
.preview-meta > span:first-child { display: inline-flex; align-items: center; gap: 5px; }
.preview-meta svg { width: 12px; height: 12px; }
#canvasSize { font-variant-numeric: tabular-nums; text-align: right; }
.settings { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.settings .panel-heading { margin-bottom: 15px; }
.identity-fields { display: grid; grid-template-columns: 1.2fr 1.35fr 1fr; gap: 12px; }
.numeric-fields { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; margin-top: 16px; }
.stepper { display: flex; align-items: center; height: 34px; border: 1px solid #434f57; border-radius: 5px; background: #161c20; overflow: hidden; }
.stepper:focus-within { border-color: var(--accent); outline: 2px solid #37dad238; outline-offset: 1px; }
.stepper input { height: 32px; border: 0; border-radius: 0; padding: 4px 1px; background: transparent; text-align: center; font-variant-numeric: tabular-nums; appearance: textfield; }
.stepper input:focus { outline: 0; }
.stepper input::-webkit-inner-spin-button { appearance: none; }
.stepper button { width: 28px; height: 32px; min-height: 32px; padding: 5px; border: 0; border-radius: 0; background: #242d33; color: #b4c8d2; flex: none; }
.stepper button:hover { background: #33524f; color: #b0fff6; }
.stepper button:focus-visible { outline-offset: -3px; }
.stepper svg { width: 13px; height: 13px; }
.color-fields { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-top: 16px; }
.color-fields label { flex-direction: row; align-items: center; gap: 8px; font-size: 12px; }
.check-label { margin-left: auto; min-height: 34px; padding: 6px 9px; border: 1px solid #424e55; border-radius: 5px; background: #1d2429; cursor: pointer; }
.check-label:has(input:checked) { background: #203d39; border-color: #4fa99e; color: #b1fff4; }
.check-label:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }

.editor-footer { position: fixed; inset: auto 0 0; z-index: 12; display: flex; align-items: center; justify-content: space-between; min-height: 70px; padding: 14px 26px; gap: 18px; background: #1a1e22; border-top: 1px solid #414b52; box-shadow: 0 -4px 18px #0002; }
.editor-footer > div { display: flex; align-items: center; gap: 8px; flex: none; margin-left: auto; }
.editor-footer button { min-height: 38px; padding-inline: 14px; }
#status { color: #a9e5d4; font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; min-width: 0; }
#status.error { color: #ffa3b8; }
#status:empty { display: none; }
#downloadBtn { border-color: #697981; background: #2a343a; }
#downloadBtn:hover { background: #3a494f; border-color: #b0c1c9; }
#saveBtn { min-width: 100px; }
#backBtn { background: transparent; border-color: transparent; color: #c0cbd1; }
#backBtn:hover { background: #2d353b; border-color: #56646c; }

dialog { width: min(1000px,94vw); max-height: 88vh; padding: 22px; border: 1px solid #596971; border-radius: 8px; background: var(--panel); color: #f1f4f5; box-shadow: 0 24px 100px #0009; }
dialog::backdrop { background: #060809cf; backdrop-filter: blur(4px); }
dialog > header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
dialog > header h2 { font-size: 18px; }
dialog > header span { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; }
dialog .search { display: flex; flex-direction: row; align-items: center; gap: 9px; padding: 0 11px; border: 1px solid #52616a; border-radius: 5px; background: #121719; }
.search svg { color: #abc3ce; width: 16px; height: 16px; }
.search input { height: 38px; border: 0; background: transparent; padding-inline: 0; }
.search input:focus { outline: 0; }
.search:focus-within { border-color: var(--accent); outline: 2px solid #37dad238; }
.gift-grid { display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); gap: 10px; max-height: 56vh; overflow-y: auto; margin-top: 16px; padding: 3px; align-content: start; }
.gift-card { position: relative; display: flex; flex-direction: column; min-width: 0; height: 154px; gap: 6px; padding: 12px 8px; border-color: #3c494f; background: #171d21; }
.gift-card img { width: 64px; height: 64px; object-fit: contain; flex: none; filter: drop-shadow(0 3px 4px #0004); }
.gift-card strong { display: flex; align-items: center; justify-content: center; min-height: 32px; font-size: 12px; line-height: 1.3; overflow-wrap: anywhere; }
.gift-card small { color: #ead29d; font-size: 11px; font-weight: 400; }
.gift-card:hover { border-color: var(--accent); background: #223735; }
.gift-card[aria-current=true] { border-color: var(--accent); background: #24423e; color: #d6fffa; box-shadow: inset 0 0 0 1px var(--accent); }
.gift-selected { position: absolute; top: 7px; right: 7px; display: flex; color: var(--accent-ink); }
.gift-selected svg { width: 16px; height: 16px; }
.saved-toolbar { display: flex; gap: 9px; margin-bottom: 10px; }
.saved-toolbar .search { flex: 1; min-width: 0; }
.saved-toolbar .icon { height: 40px; }
.saved-item { display: flex; align-items: center; gap: 9px; padding: 15px 0; border-bottom: 1px solid var(--line); }
.saved-item > div { flex: 1; min-width: 0; }
.saved-item b { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.saved-item small { display: block; margin-top: 6px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.saved-item [data-edit] { border-color: #467c76; background: #223c38; color: #adf5e9; }
.saved-item [data-edit]:hover { border-color: var(--accent); background: #2b514a; }
.saved-empty { padding: 32px 8px; text-align: center; color: var(--muted); font-size: 12px; }
.gift-grid > .saved-empty { grid-column: 1/-1; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 18px; color: var(--muted); font-size: 11px; }
#colorsModal { width: min(420px,94vw); }
#colorsModal .color-fields { gap: 16px; margin-bottom: 20px; }
#resetLineColors { width: 100%; }
#confirmModal { width: min(460px,94vw); }
#confirmModal p { margin: 18px 0; color: #bcc7cd; line-height: 1.6; overflow-wrap: anywhere; }
#confirmModal footer { display: flex; justify-content: flex-end; gap: 9px; }

@media (min-width:1600px) {
  .editor-layout { grid-template-columns: 364px minmax(0,1fr); gap: 28px; }
  .gift-panel { padding-right: 26px; }
}
@media (min-width:1200px) and (min-height:900px) {
  .design-workspace { position: sticky; top: 84px; }
}
@media (max-width:1100px) {
  .app-title { display: none; }
  .editor-layout { grid-template-columns: 300px minmax(0,1fr); gap: 20px; }
  .gift-panel { padding-right: 18px; }
  .identity-fields { grid-template-columns: 1.3fr 1fr; }
  .identity-fields label:first-child { grid-column: 1/-1; }
  .numeric-fields { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px 9px; }
  .color-fields { gap: 12px; }
  .check-label { margin-left: 0; }
}
@media (max-width:760px) {
  .appbar { min-height: 60px; padding: 11px 16px; gap: 12px; }
  .brand { font-size: 27px; }
  .appbar nav { gap: 6px; }
  #closeDesigner { margin-left: 0; }
  main { padding: 19px 16px 136px; }
  .editor-heading { gap: 12px; margin-bottom: 20px; align-items: flex-start; }
  .editor-heading h1 { font-size: 20px; }
  #saveState { max-width: 140px; font-size: 10px; }
  .editor-layout { display: flex; flex-direction: column-reverse; gap: 25px; }
  .design-workspace, .gift-panel { width: 100%; }
  .gift-panel { padding: 21px 0 0; border-right: 0; border-top: 1px solid var(--line); }
  .preview-checker { height: 240px; padding: 12px; }
  .settings { margin-top: 18px; padding-top: 16px; }
  .identity-fields { gap: 12px 10px; }
  .numeric-fields { margin-top: 14px; gap: 12px 9px; }
  .numeric-fields label { font-size: 11px; }
  .color-fields { gap: 12px; }
  .color-fields label { font-size: 11px; }
  .check-label { margin-left: 0; }
  .editor-footer { padding: 11px 16px; min-height: 64px; gap: 8px; flex-wrap: wrap; }
  .editor-footer > div { width: 100%; justify-content: flex-end; }
  #status { flex-basis: 100%; font-size: 11px; }
  dialog { padding: 18px; }
  .gift-grid { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; }
  .saved-item { flex-wrap: wrap; }
  .saved-item > div { flex-basis: 100%; }
}
@media (max-width:520px) {
  #newBtn span, #backBtn span { display: none; }
  #newBtn { width: 36px; padding: 7px; }
  #backBtn { width: 38px; padding: 8px; margin-right: auto; }
  .appbar nav button { padding-inline: 9px; }
  .appbar nav .icon { padding: 7px; }
  .editor-footer button { padding-inline: 12px; }
  .preview-checker { height: 210px; }
  .gift-card { height: 148px; padding: 10px 6px; }
  .gift-card img { width: 58px; height: 58px; }
  .gift-card strong { font-size: 11px; }
}
@media (max-width:380px) {
  #designsBtn span { display: none; }
  #designsBtn { width: 36px; padding: 7px; }
  .numeric-fields { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .color-fields { gap: 10px; }
  .color-fields label { gap: 5px; }
  .gift-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  #saveState { max-width: 110px; }
}
@media (prefers-reduced-motion:reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}
