:root {
  color-scheme: dark;
  --ink: #f7f5ff;
  --muted: #aaa4b8;
  --violet: #a970ff;
  --violet-bright: #c8a7ff;
  --surface: #181521;
  --surface-raised: #211c2d;
  --line: #3c344c;

  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: #0e0c13;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 76% 5%, #54308a2b, transparent 26rem),
    linear-gradient(120deg, #15111f 0%, #0e0c13 48%, #121019 100%);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

h1,
h2,
p {
  margin: 0;
}

.brand-stripe {
  position: fixed;
  inset: 0 auto 0 0;
  width: 5px;
  background: linear-gradient(180deg, #d8bfff, var(--violet) 42%, #7542bb 75%, #2c1b46);
}

.settings-shell {
  display: grid;
  grid-template-columns: minmax(290px, 430px) minmax(420px, 1fr);
  gap: 24px 42px;
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  padding: 64px 0 72px;
}

.page-header,
.settings-form {
  grid-column: 1;
}

.page-header {
  align-self: end;
}

.product-mark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 42px;
  color: var(--ink);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.16em;
  text-decoration: none;
}

.product-mark i {
  width: 26px;
  height: 3px;
  background: linear-gradient(90deg, var(--violet), var(--violet-bright));
  box-shadow: 0 0 12px #a970ff99;
}

.eyebrow {
  color: var(--violet-bright);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1 {
  max-width: 620px;
  margin-top: 13px;
  font-size: clamp(44px, 5.4vw, 74px);
  font-weight: 830;
  letter-spacing: -0.065em;
  line-height: 0.94;
}

.intro {
  max-width: 38rem;
  margin-top: 24px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
}

.settings-form {
  display: grid;
  gap: 14px;
}

.control-panel,
.preview-panel,
.url-panel {
  border: 1px solid var(--line);
  border-radius: 12px 4px 12px 4px;
  background: linear-gradient(145deg, #211c2dec, #17131fed);
  box-shadow: 0 22px 50px #0504084d, inset 0 1px 0 #ffffff0b;
}

.control-panel {
  padding: 21px;
}

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

.section-heading h2,
.url-panel h2 {
  font-size: 18px;
  font-weight: 760;
  letter-spacing: -0.025em;
}

.section-heading > span {
  color: #8f879d;
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.field-label,
.field-group legend,
.select-grid label,
.color-field > span {
  color: #c8c1d2;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.channel-field {
  display: flex;
  margin-top: 8px;
  border: 1px solid #51475f;
  border-radius: 7px;
  background: #0d0b12a8;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.channel-field:focus-within {
  border-color: var(--violet);
  box-shadow: 0 0 0 3px #a970ff24;
}

.channel-field span {
  padding: 11px 0 11px 12px;
  color: #867e91;
}

.channel-field input {
  width: 100%;
  min-width: 0;
  padding: 11px 12px 11px 4px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.field-group {
  margin: 20px 0 0;
  padding: 0;
  border: 0;
}

.segmented-control {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-top: 8px;
  padding: 4px;
  border: 1px solid #3a3247;
  border-radius: 8px;
  background: #0d0b12a8;
}

.segmented-control input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented-control label {
  padding: 9px 10px;
  border-radius: 5px;
  color: #9e97aa;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  transition: background 150ms ease, color 150ms ease;
  cursor: pointer;
}

.segmented-control input:checked + label {
  background: #a970ff20;
  color: var(--ink);
  box-shadow: inset 0 0 0 1px #a970ff5c;
}

.segmented-control input:focus-visible + label {
  outline: 2px solid var(--violet-bright);
  outline-offset: 2px;
}

.color-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
}

.color-field {
  display: grid;
  gap: 7px;
  min-width: 0;
  padding: 10px;
  border: 1px solid #3c3448;
  border-radius: 8px;
  background: #100d16a3;
  transition: border-color 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

.color-field.is-active {
  border-color: #a970ff8c;
  background: #a970ff0d;
  box-shadow: inset 0 -2px 0 #a970ff70;
}

.color-trigger {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.color-swatch {
  width: 34px;
  height: 28px;
  border: 1px solid #ffffff24;
  border-radius: 5px;
  box-shadow: inset 0 1px 0 #ffffff24, 0 4px 12px #0000002e;
}

.color-field output {
  align-self: center;
  overflow: hidden;
  color: #a9a1b4;
  font-family: ui-monospace, "Cascadia Mono", monospace;
  font-size: 9px;
  text-overflow: ellipsis;
}

.color-editor {
  --picker-color: #a970ff;
  --picker-hue: 270;
  --picker-saturation: 100%;

  display: grid;
  grid-template-columns: minmax(0, 1fr) 116px;
  gap: 15px 18px;
  margin-top: 10px;
  padding: 14px;
  border: 1px solid #463b55;
  border-radius: 9px 3px 9px 3px;
  background:
    radial-gradient(circle at 12% 0%, color-mix(in srgb, var(--picker-color) 16%, transparent), transparent 8rem),
    #0d0b12c7;
}

.color-editor-header {
  display: flex;
  align-items: center;
  gap: 11px;
}

.color-editor-sample {
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  border: 1px solid #ffffff30;
  border-radius: 8px 2px 8px 2px;
  box-shadow: 0 0 22px color-mix(in srgb, var(--picker-color) 30%, transparent), inset 0 1px 0 #ffffff2e;
}

.color-editor-header p,
.hex-control > span,
.color-sliders label > span,
.quick-colors > span {
  color: #8f879d;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.color-editor-header h3 {
  margin: 3px 0 0;
  font-size: 16px;
  letter-spacing: -0.02em;
}

.hex-control {
  display: grid;
  gap: 6px;
}

#color-hex {
  width: 100%;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid #4b4258;
  border-radius: 6px;
  outline: 0;
  background: #09070d;
  color: var(--ink);
  font-family: ui-monospace, "Cascadia Mono", monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

#color-hex[aria-invalid="true"] {
  border-color: #ff786f;
  box-shadow: 0 0 0 3px #ff786f1f;
}

.color-sliders {
  display: grid;
  grid-column: 1 / 3;
  gap: 11px;
}

.color-sliders label {
  display: grid;
  gap: 7px;
}

.color-sliders label > span {
  display: flex;
  justify-content: space-between;
}

.color-sliders output {
  color: #c7bfce;
  font-family: ui-monospace, "Cascadia Mono", monospace;
}

.color-sliders input[type="range"] {
  width: 100%;
  height: 32px;
  margin: 0;
  appearance: none;
  border: 0;
  outline: 0;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 8px;
  cursor: ew-resize;
  touch-action: pan-y;
}

#color-hue {
  background: linear-gradient(90deg, #ff3b3b, #fff23b, #3bff6a, #3be8ff, #483bff, #d83bff, #ff3b6a);
}

#color-saturation {
  background: linear-gradient(90deg, hsl(var(--picker-hue), 0%, 50%), hsl(var(--picker-hue), 100%, 50%));
}

#color-lightness {
  background: linear-gradient(90deg, #000, hsl(var(--picker-hue), var(--picker-saturation), 50%), #fff);
}

.color-sliders input[type="range"]::-webkit-slider-thumb {
  width: 16px;
  height: 16px;
  appearance: none;
  border: 2px solid #f7f5ff;
  border-radius: 50%;
  background: var(--picker-color);
  box-shadow: 0 1px 7px #000c;
}

.color-sliders input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 2px solid #f7f5ff;
  border-radius: 50%;
  background: var(--picker-color);
  box-shadow: 0 1px 7px #000c;
}

.quick-colors {
  display: grid;
  grid-column: 1 / 3;
  gap: 8px;
}

.quick-colors > div {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.quick-colors button {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid #ffffff2e;
  border-radius: 50%;
  box-shadow: inset 0 1px 0 #ffffff33, 0 3px 10px #0006;
}

.quick-colors button[aria-pressed="true"] {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.select-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  margin-top: 16px;
}

.select-grid label {
  display: grid;
  gap: 8px;
}

select {
  width: 100%;
  min-width: 0;
  padding: 9px 30px 9px 10px;
  border: 1px solid #4b4258;
  border-radius: 7px;
  background: #100d16;
  color: var(--ink);
  font-size: 12px;
  text-transform: none;
}

.reset-button {
  justify-self: start;
  padding: 7px 2px;
  border: 0;
  background: transparent;
  color: #9f96ad;
  font-size: 11px;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: #6e617c;
  text-underline-offset: 4px;
}

.preview-panel {
  grid-column: 2;
  grid-row: 1 / 3;
  align-self: stretch;
  min-width: 0;
  padding: 21px;
}

.preview-panel .section-heading {
  margin-bottom: 28px;
}

.preview-panel .section-heading h2 {
  margin-top: 5px;
  font-size: 26px;
}

.preview-stage {
  display: grid;
  min-height: 360px;
  padding: clamp(18px, 4vw, 52px);
  overflow: hidden;
  border: 1px solid #352d41;
  border-radius: 9px;
  background:
    linear-gradient(45deg, #ffffff08 25%, transparent 25%, transparent 75%, #ffffff08 75%),
    linear-gradient(45deg, #ffffff08 25%, transparent 25%, transparent 75%, #ffffff08 75%),
    #0a080d;
  background-position: 0 0, 10px 10px;
  background-size: 20px 20px;
  place-items: center;
}

.preview-stage iframe {
  width: 100%;
  height: 140px;
  border: 0;
  background: transparent;
}

.preview-note {
  margin-top: 15px;
  color: #928a9e;
  font-size: 11px;
  line-height: 1.5;
}

.url-panel {
  display: grid;
  grid-column: 1 / 3;
  grid-template-columns: minmax(170px, 0.4fr) minmax(0, 1fr);
  gap: 18px 24px;
  align-items: center;
  padding: 22px;
}

.url-panel h2 {
  margin-top: 5px;
}

#overlay-url {
  width: 100%;
  resize: none;
  padding: 12px;
  border: 1px solid #4b4258;
  border-radius: 7px;
  outline: 0;
  background: #0d0b12;
  color: #d8d1e3;
  font-family: ui-monospace, "Cascadia Mono", monospace;
  font-size: 11px;
  line-height: 1.45;
}

#overlay-url:focus-visible,
select:focus-visible,
.color-trigger:focus-visible,
#color-hex:focus-visible,
.color-sliders input:focus-visible,
.quick-colors button:focus-visible,
.reset-button:focus-visible,
.primary-action:focus-visible,
.secondary-action:focus-visible,
.page-footer a:focus-visible {
  outline: 2px solid var(--violet-bright);
  outline-offset: 2px;
}

.url-actions {
  display: flex;
  grid-column: 2;
  align-items: center;
  gap: 10px;
}

.primary-action,
.secondary-action {
  padding: 10px 15px;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-decoration: none;
}

.primary-action {
  border: 1px solid #bb91ff;
  background: linear-gradient(135deg, #b17cff, #8951df);
  color: #130d1c;
  box-shadow: 0 8px 24px #a970ff3d;
}

.secondary-action {
  border: 1px solid #51475f;
  background: #17131f;
  color: var(--ink);
}

.primary-action:disabled,
.secondary-action[aria-disabled="true"] {
  opacity: 0.45;
  pointer-events: none;
}

#copy-status {
  min-width: 80px;
  color: #a9e6ca;
  font-size: 11px;
  font-weight: 700;
}

.page-footer {
  grid-column: 1 / -1;
  margin-top: 18px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.page-footer a {
  color: var(--violet-bright);
  font-weight: 700;
  text-decoration-color: #a970ff80;
  text-underline-offset: 3px;
}

.page-footer a:hover {
  color: var(--ink);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 900px) {
  .settings-shell {
    grid-template-columns: 1fr;
    width: min(680px, calc(100% - 36px));
    padding-top: 42px;
  }

  .page-header,
  .settings-form,
  .preview-panel,
  .url-panel {
    grid-column: 1;
  }

  .preview-panel {
    grid-row: auto;
  }

  .url-panel {
    grid-template-columns: 1fr;
  }

  .url-actions {
    grid-column: 1;
  }
}

@media (max-width: 520px) {
  .settings-shell {
    width: min(100% - 24px, 680px);
    padding: 30px 0 48px;
  }

  .product-mark {
    margin-bottom: 32px;
  }

  .color-grid,
  .select-grid {
    grid-template-columns: 1fr;
  }

  .color-field {
    padding: 11px;
  }

  .color-editor {
    grid-template-columns: 1fr;
  }

  .hex-control,
  .color-sliders,
  .quick-colors {
    grid-column: 1;
  }

  .preview-stage {
    min-height: 250px;
    padding: 12px;
  }

  .url-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .primary-action,
  .secondary-action {
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
