:root {
  --field: #84bce8;
  --ink: #151b2d;
  --muted: #687184;
  --panel: rgba(253, 254, 255, .97);
  --hairline: #dfe4ec;
  --accent: #448fe7;
}

* { box-sizing: border-box; }
html { background: #cfe4f8; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 82% 24%, rgba(245, 222, 255, .9), transparent 27rem),
    radial-gradient(circle at 16% 70%, rgba(255, 255, 255, .8), transparent 24rem),
    linear-gradient(135deg, #a8d8f6 0%, #d4e6fa 46%, #efdafa 100%);
  font-family: "Avenir Next", Avenir, "Helvetica Neue", sans-serif;
}
button, input, select { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

main { width: min(1180px, calc(100% - 20px)); margin: 0 auto; padding-bottom: 58px; }
.intro {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 28px;
  margin: 0 auto 14px;
  padding: 0 2px;
}
.intro h1 { margin: 0; font-size: clamp(1.75rem, 5vw, 3.35rem); line-height: .94; letter-spacing: -.055em; }
.intro > p { max-width: 31rem; margin: 0; color: #46536a; font-size: clamp(.82rem, 1.6vw, 1rem); line-height: 1.45; text-align: right; }
.kicker { margin: 0 0 6px; color: #4b6078; font: 700 .66rem/1.2 var(--pg-font-mono); letter-spacing: .08em; text-transform: uppercase; }

.workbench {
  display: grid;
  grid-template-columns: 304px minmax(0, 1fr);
  grid-template-areas: "inspector preview";
  min-height: 560px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.84);
  border-radius: 34px;
  background: rgba(255,255,255,.42);
  box-shadow: 0 28px 70px rgba(43, 77, 130, .22), inset 0 0 0 7px rgba(255,255,255,.24);
}
.inspector {
  grid-area: inspector;
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  max-height: 620px;
  padding: 23px 19px 16px;
  overflow-y: auto;
  background: var(--panel);
  border-right: 1px solid rgba(37,56,91,.08);
  scrollbar-width: thin;
}
.preview-wrap { grid-area: preview; position: relative; min-width: 0; min-height: 560px; overflow: hidden; }
.preview {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #78b0df;
  isolation: isolate;
}
.preview svg { width: 100%; height: 100%; display: block; }
.preview-meta {
  position: absolute;
  right: 18px;
  bottom: 16px;
  z-index: 3;
  display: flex;
  gap: 8px;
  pointer-events: none;
}
.preview-meta span {
  padding: 6px 9px;
  border: 1px solid rgba(255,255,255,.6);
  border-radius: 999px;
  color: #fff;
  background: rgba(19, 38, 82, .35);
  box-shadow: 0 4px 20px rgba(10,36,85,.12);
  backdrop-filter: blur(12px);
  font: 700 .62rem/1 var(--pg-font-mono);
}

.brand-lockup { display: flex; align-items: center; gap: 10px; padding: 0 3px 16px; border-bottom: 1px solid var(--hairline); }
.brand-lockup strong { display: block; font-size: 1.17rem; letter-spacing: -.04em; }
.brand-lockup small { display: block; margin-top: 2px; color: var(--muted); font: 600 .55rem/1.2 var(--pg-font-mono); text-transform: uppercase; letter-spacing: .04em; }
.brand-mark { position: relative; display: grid; place-items: center; width: 31px; height: 31px; border: 2px solid var(--ink); border-radius: 50%; }
.brand-mark i { position: absolute; width: 13px; height: 13px; border: 1.5px solid var(--ink); border-radius: 50%; }
.brand-mark i:nth-child(2) { transform: translateX(5px); }
.brand-mark i:nth-child(3) { transform: translateX(-5px); }

.preset-strip { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 6px; padding: 14px 0; border-bottom: 1px solid var(--hairline); }
.preset-strip button {
  min-height: 31px;
  padding: 5px 4px;
  border: 1px solid #cbd3df;
  border-radius: 7px;
  color: #25304a;
  background: #fff;
  font-size: .62rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}
.preset-strip button:hover, .preset-strip button:focus-visible { border-color: #7283a1; background: #f5f8fc; }
.preset-strip button[aria-pressed="true"] { border-color: #99a75f; background: #f4f7df; box-shadow: inset 0 0 0 1px #ccd58d; }
.preset-strip button:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid rgba(68,143,231,.45); outline-offset: 2px; }

#controls { padding-top: 3px; }
.select-row, .range-row, .toggle-row { color: #5a657a; font: 700 .6rem/1.2 var(--pg-font-mono); text-transform: uppercase; letter-spacing: .025em; }
.select-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; border-bottom: 1px solid var(--hairline); }
select { max-width: 145px; border: 0; color: #172039; background: transparent; font: 700 .72rem/1.2 var(--pg-font-mono); text-align: right; }
.range-row { display: block; padding: 10px 0 8px; border-bottom: 1px solid var(--hairline); }
.range-row > span { display: flex; justify-content: space-between; gap: 10px; }
output { color: #8891a2; font-weight: 600; text-transform: none; }
input[type="range"] {
  width: 100%;
  height: 18px;
  margin: 5px 0 0;
  appearance: none;
  background: transparent;
  cursor: ew-resize;
}
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 99px; background: linear-gradient(90deg, var(--ink) 0 var(--fill, 50%), #e5e8ee var(--fill, 50%) 100%); }
input[type="range"]::-webkit-slider-thumb { width: 15px; height: 15px; margin-top: -5.5px; appearance: none; border: 1.5px solid var(--ink); border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.1); }
.toggle-stack { border-bottom: 1px solid var(--hairline); padding: 7px 0; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; min-height: 31px; }
.toggle-row.modifier { padding-left: 10px; color: #7b8494; }
input[type="checkbox"] { position: relative; width: 28px; height: 16px; appearance: none; border-radius: 99px; background: #dfe3ea; transition: background .18s ease; }
input[type="checkbox"]::after { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.22); transition: transform .18s ease; }
input[type="checkbox"]:checked { background: var(--ink); }
input[type="checkbox"]:checked::after { transform: translateX(12px); }
input[type="checkbox"]:disabled { opacity: .45; }

.export-panel { margin-top: auto; padding-top: 13px; }
.background-panel { min-width: 0; margin: 12px 0 0; padding: 0 0 12px; border: 0; border-bottom: 1px solid var(--hairline); }
.background-panel legend { padding: 0; color: #5a657a; font: 700 .6rem/1.2 var(--pg-font-mono); letter-spacing: .025em; text-transform: uppercase; }
.background-actions { display: flex; align-items: center; gap: 7px; margin-top: 8px; }
#background-upload { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.upload-button, #remove-background { min-height: 31px; padding: 8px 10px; border: 1px solid #cbd3df; border-radius: 8px; color: #25304a; background: #fff; font-size: .65rem; font-weight: 750; line-height: 1; cursor: pointer; }
.upload-button { flex: 1; text-align: center; }
.upload-button:hover, .upload-button:focus-within, #remove-background:hover { border-color: #7283a1; background: #f5f8fc; }
#remove-background { color: #7d4a50; }
#remove-background[hidden] { display: none !important; }
#background-name { display: block; margin-top: 7px; overflow: hidden; color: #7d8799; font: 600 .58rem/1.35 var(--pg-font-mono); text-overflow: ellipsis; white-space: nowrap; }
.background-fit { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 7px; color: #697387; font: 700 .58rem/1.2 var(--pg-font-mono); text-transform: uppercase; }
.background-fit select { font-size: .65rem; }
.export-primary, .export-grid button { border: 0; border-radius: 9px; cursor: pointer; }
.export-primary { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 42px; color: #071a36; background: #63aaf0; font-weight: 750; box-shadow: 0 6px 18px rgba(54,128,205,.2); }
.export-primary:hover { background: #75b6f4; }
.export-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 6px; margin-top: 7px; }
.export-grid button { min-height: 31px; padding: 4px; border: 1px solid #d4dbe5; color: #667086; background: #fff; font-size: .61rem; font-weight: 700; }
#status { min-height: 13px; margin: 7px 0 0; color: #48627d; font: 650 .57rem/1.25 var(--pg-font-mono); text-align: center; }

.system-note { max-width: 920px; margin: 54px auto 0; padding: 0 10px; }
.system-note h2 { max-width: 760px; margin: 0; font-size: clamp(1.7rem, 4vw, 3.1rem); line-height: 1.02; letter-spacing: -.05em; }
.ownership-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 30px; margin-top: 28px; padding-top: 18px; border-top: 1px solid rgba(39,57,84,.2); }
.ownership-grid p { margin: 0; }
.ownership-grid strong, .ownership-grid span { display: block; }
.ownership-grid strong { margin-bottom: 6px; font: 800 .68rem/1 var(--pg-font-mono); text-transform: uppercase; letter-spacing: .04em; }
.ownership-grid span, .credit { color: #4b5b71; font-size: .88rem; line-height: 1.5; }
.credit { max-width: 750px; margin: 28px 0 0; }

@media (max-width: 760px) {
  main { width: min(100% - 18px, 520px); padding-bottom: 44px; }
  .intro { align-items: start; margin-bottom: 10px; }
  .intro > p { max-width: 12.8rem; font-size: .74rem; text-align: left; }
  .kicker { font-size: .56rem; }
  .workbench { display: flex; flex-direction: column; min-height: 0; border-radius: 24px; overflow: visible; box-shadow: 0 18px 44px rgba(43,77,130,.2); }
  .preview-wrap { order: 1; min-height: 0; height: min(56vw, 278px); border-radius: 24px 24px 0 0; }
  .preview { border-radius: inherit; }
  .preview-meta { right: 10px; bottom: 10px; }
  .preview-meta span:first-child { display: none; }
  .inspector { order: 2; max-height: none; padding: 15px 14px 14px; overflow: visible; border: 0; border-radius: 0 0 24px 24px; }
  .brand-lockup { padding-bottom: 11px; }
  .brand-mark { width: 26px; height: 26px; }
  .brand-lockup strong { font-size: 1rem; }
  .preset-strip { display: flex; gap: 7px; margin: 0 -14px; padding: 11px 14px 12px; overflow-x: auto; }
  .preset-strip button { flex: 0 0 auto; min-width: 82px; }
  .select-row { min-height: 44px; }
  .range-row { padding: 8px 0 6px; }
  .toggle-row { min-height: 29px; }
  .export-panel { margin-top: 0; }
  .system-note { margin-top: 38px; padding: 0 4px; }
  .ownership-grid { grid-template-columns: 1fr; gap: 16px; }
}

@media (max-width: 420px) {
  .intro h1 { font-size: 1.63rem; }
  .intro > p { max-width: 10.8rem; line-height: 1.3; }
  .preview-wrap { height: 244px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .001ms !important; animation-duration: .001ms !important; animation-iteration-count: 1 !important; }
}
