/* The standalone editor stylesheet, scoped so it cannot alter the landing page. */
@keyframes spin{
  to { transform: rotate(360deg); }
}

@scope (#blur-app) {
:scope {
  color-scheme: dark;
  --bg: #0b0d10;
  --panel: #0f1217;
  --panel2: #121723;
  --text: #e9eef7;
  --muted: rgba(233, 238, 247, 0.68);
  --border: rgba(233, 238, 247, 0.12);
  --border2: rgba(233, 238, 247, 0.18);
  --accent: #8b3dff;
  --accent2: #a77bff;
  --btn: rgba(233, 238, 247, 0.08);
  --btnHover: rgba(233, 238, 247, 0.12);
  --btnActive: rgba(139, 61, 255, 0.2);
  --shadow: rgba(0,0,0,0.35);
}

:scope, :scope * { box-sizing: border-box; }
:scope { height: 100%; }
/* Ensure native `hidden` always hides, even if component classes set display. */
[hidden] { display: none !important; }
:scope {
  margin: 0;
  font-family: "Space Grotesk", ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  background: var(--bg);
  color: var(--text);
}

.app { height: 100%; display: flex; flex-direction: column; }

.appHeaderShell{
  position: sticky;
  top: 0;
  z-index: 45;
  background: #fff;
  border-bottom: 1px solid rgba(0,0,0,0.08);
}
/* Homepage-like nav bar styles (scoped to app header so it doesn’t affect the editor UI) */
.appHeaderShell .site-nav{
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 14px;
  position: relative;
}
.appHeaderShell .nav-links{
  display: flex;
  align-items: center;
  gap: 18px;
}
.appHeaderShell .nav-links a{
  font-size: 14px;
  color: #000;
  font-weight: 600;
  text-decoration: none;
}
.appHeaderShell .nav-links a.active{ color: #893dff; }
.appHeaderShell .nav-toggle{
  display: none;
  background: transparent;
  border: 0;
  padding: 0;
}
.appHeaderShell .nav-app-btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  border-radius: 6px;
  background: #000;
  color: #fff !important;
}
.appHeaderShell .nav-app-btn:hover,
.appHeaderShell .nav-app-btn:focus{
  background: #111;
  color: #fff !important;
}
.appHeaderShell .nav-app-btn.active{ opacity: 1; color: #fff !important; }

@media (max-width: 768px) {
  .appHeaderShell .nav-toggle{ display: inline-flex; }
  .appHeaderShell .nav-links{ display: none; }
  .appHeaderShell .nav-links[data-open="true"]{
    display: block;
    position: absolute;
    top: 64px;
    right: 14px;
    width: min(240px, calc(100vw - 28px));
    background: #fff;
    border-radius: 12px;
    padding: 10px;
    box-shadow: 0 18px 60px rgba(0,0,0,0.18);
    border: 1px solid rgba(0,0,0,0.08);
  }
  .appHeaderShell .nav-links[data-open="true"] a{
    display: block;
    padding: 12px 10px;
    border-radius: 10px;
  }
  .appHeaderShell .nav-links[data-open="true"] a:hover{ background: rgba(0,0,0,0.04); }
  .appHeaderShell .nav-links[data-open="true"] a.nav-app-btn{
    display: inline-flex;
    width: auto;
    padding: 8px 12px;
    border-radius: 6px;
    background: #000;
    color: #fff !important;
  }
  .appHeaderShell .nav-links[data-open="true"] a.nav-app-btn:hover,
  .appHeaderShell .nav-links[data-open="true"] a.nav-app-btn:focus{
    background: #111;
    color: #fff !important;
  }
}

.main { flex: 1; display: grid; grid-template-columns: 330px 1fr; min-height: 0; }

.panel {
  border-right: 1px solid var(--border);
  background:  rgba(11, 13, 16,1.0);
  overflow: hidden;
  position: relative;
}
.panel__scroll {
  height: 100%;
  overflow: auto;
  padding: 14px;
}
.requiresImage { display: block; }
:scope:not(.has-image) .requiresImage { display: none; }
.panel__section {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 12px;
}
.panel__section__noBorder {
  background: rgba(11, 13, 16, 0.35);
  border-radius: 14px;
  margin-bottom: 12px;
}
.panel__section--body { padding-top: 14px; }
.panel__title {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
  margin-bottom: 10px;
}

.betaPill{
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  background: #ffffff;
  color: #0b0d10;
  font-weight: 900;
  font-size: 12px;
  letter-spacing: 0.01em;
  margin-bottom: 10px;
}

.subhead {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 10px;
}
.muted { color: var(--muted); font-size: 13px; }
.hintBox{
  border-radius: 12px;
  border: 1px solid rgba(60, 138, 255, 0.40);
  background: rgba(60, 138, 255, 0.14);
  padding: 10px 12px;
  color: rgba(233,238,247,0.92);
  font-size: 13px;
  line-height: 1.35;
  margin-bottom: 12px;
}

.row { display: flex; gap: 10px; margin-top: 10px; }
.row--split > * { flex: 1; }
.row:first-child { margin-top: 0; }

/* Text tool: Font dropdown + 2 square buttons (only the dropdown should flex) */
.textFontRow{ align-items: center; }
.textFontRow > *{ flex: 0 0 auto; }
.textFontRow #fontBtn{ flex: 1 1 auto; min-width: 0; }
.textFontRow .iconBtn--sq{ flex: 0 0 44px; }

.field { margin-top: 12px; }
.field:first-child { margin-top: 0; }
.field__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}
.field__label { display: block; font-size: 12px; color: var(--text); margin-bottom: 6px; }
.field__value { margin-top: 6px; font-size: 12px; color: var(--muted); }

/* Disabled styling (used in Edit blur masks sidebar inspector) */
.field.is-disabled .field__label{
  color: var(--muted);
}
label.toggle.is-disabled,
label.check.is-disabled{
  color: var(--muted);
}

/* Slider component (applied to all range inputs in the app) */
input[type="range"]{
  --slider-h: 6px;
  --slider-track: rgba(233, 238, 247, 0.18);
  --slider-track2: rgba(233, 238, 247, 0.10);
  --range-pct: 0%;

  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  height: 26px; /* gives room for thumb glow */
  margin: 0;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track{
  height: var(--slider-h);
  border-radius: 999px;
  background: linear-gradient(
    to right,
    var(--accent) 0%,
    var(--accent) var(--range-pct),
    var(--slider-track) var(--range-pct),
    var(--slider-track2) 100%
  );
}

input[type="range"]::-webkit-slider-thumb{
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #ffffff;
  border: 0;
  margin-top: calc((var(--slider-h) - 18px) / 2);
  box-shadow: 0 10px 22px rgba(0,0,0,0.28);
}

input[type="range"]:focus-visible::-webkit-slider-thumb{
  box-shadow:
    0 0 0 6px rgba(233, 238, 247, 0.20),
    0 0 0 12px rgba(139, 61, 255, 0.20),
    0 12px 26px rgba(0,0,0,0.40);
}

input[type="range"]:hover:not(:active)::-webkit-slider-thumb{
  box-shadow:
    0 0 0 6px rgba(233, 238, 247, 0.18),
    0 0 0 10px rgba(139, 61, 255, 0.14),
    0 10px 22px rgba(0,0,0,0.35);
}

input[type="range"]:active::-webkit-slider-thumb{
  background: #ffffff;
  box-shadow:
    0 0 0 6px rgba(139, 61, 255, 0.18),
    0 0 0 10px rgba(139, 61, 255, 0.24),
    0 10px 22px rgba(0,0,0,0.35);
}

/* Firefox */
input[type="range"]::-moz-range-track{
  height: var(--slider-h);
  border-radius: 999px;
  background: var(--slider-track2);
}
input[type="range"]::-moz-range-progress{
  height: var(--slider-h);
  border-radius: 999px;
  background: var(--accent);
}
input[type="range"]::-moz-range-thumb{
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #ffffff;
  border: 0;
  box-shadow: 0 10px 22px rgba(0,0,0,0.28);
}

input[type="range"]:hover:not(:active)::-moz-range-thumb{
  box-shadow:
    0 0 0 6px rgba(233, 238, 247, 0.18),
    0 0 0 10px rgba(139, 61, 255, 0.14),
    0 10px 22px rgba(0,0,0,0.35);
}

input[type="range"]:active::-moz-range-thumb{
  background: #ffffff;
  box-shadow:
    0 0 0 6px rgba(139, 61, 255, 0.18),
    0 0 0 10px rgba(139, 61, 255, 0.24),
    0 10px 22px rgba(0,0,0,0.35);
}

input[type="range"]:disabled{
  opacity: 0.45;
  cursor: not-allowed;
}

/* Layout helper: range + number box on the right */
.rangeRow{
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}

/* Hide the "value below slider" rows (keep other values elsewhere) */
input[type="range"] + .field__value{ display: none; }
.select {
  width: 100%;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border2);
  background: rgba(233, 238, 247, 0.06);
  color: var(--text);
  padding: 0 10px;
}
.select--pretty{
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20width%3D%2724%27%20height%3D%2724%27%20viewBox%3D%270%200%2024%2024%27%3E%3Cpath%20d%3D%27m6%209%206%206%206-6%27%20fill%3D%27none%27%20stroke%3D%27%23E9EEF7%27%20stroke-width%3D%272.5%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 18px 18px;
}
.select--pretty:focus{
  outline: none;
  border-color: rgba(139,61,255,0.75);
  box-shadow: 0 0 0 4px rgba(139,61,255,0.18);
}
.select--hidden {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.toggle { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--text); user-select: none; }
.toggle input { accent-color: var(--accent); }

.toggleCol{
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.check { display: flex; gap: 10px; align-items: center; font-size: 13px; color: var(--text); user-select: none; }
.check input { accent-color: var(--accent); }

.tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.tab {
  height: 34px;
  border: 0;
  background: rgba(233,238,247,0.04);
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
}
.tab:hover { background: rgba(233,238,247,0.06); }
.tab--active {
  background: rgba(139,61,255,0.25);
}

.file input { position: absolute; left: -9999px; }
.fileInputHidden{
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.fileRow {
  display: flex;
  gap: 10px;
  align-items: center;
}
.fileRow .file { flex: 1; }
.file__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 42px;
  width: 100%;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid var(--border2);
  background: rgba(233, 238, 247, 0.06);
  color: var(--text);
  cursor: pointer;
  user-select: none;
}
.file__btn:hover { background: rgba(233, 238, 247, 0.10); }
.file__btn--big{
  height: 52px;
  border-radius: 14px;
  font-weight: 900;
  font-size: 14px;
}

.uploadBox{
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 14px;
}

.shapeRow{
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 10px;
  align-items: start;
  margin-top: 10px;
}
.shapeBtn{
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  color: var(--text);
}
.shapeIcon{
  display: block;
  width: 64px;
  height: 64px;
  border-radius: 18px;
  margin: 0 auto;
  display: grid;
  place-items: center;
  color: rgba(111, 119, 133, 0.85);
}
.shapeIcon svg{
  width: 34px;
  height: 34px;
  display: block;
}
.shapeIcon--face{ border-radius: 20px; width: 52px; height: 64px; }
.shapeIcon--square{ border-radius: 16px; }
.shapeIcon--circle{ border-radius: 999px; }
.shapeLabel{
  display: block;
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  font-weight: 700;
}
.shapeMoreBtn{
  width: 34px;
  height: 64px;
  border-radius: 12px;
  border: 1px solid rgba(233,238,247,0.14);
  background: rgba(233,238,247,0.06);
  color: var(--text);
  display: grid;
  place-items: center;
}

.textPreview{
  margin-top: 10px;
  height: 150px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  overflow: hidden;
  color: #893dff;
  font-weight: 900;
  font-size: 44px;
  letter-spacing: 0.02em;
  text-align: center;
  line-height: var(--textPreview-lineHeight, 1.0);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  user-select: none;
}
.textPreview__inner{
  width: 100%;
  max-width: 100%;
}
.textPreview[data-align="left"]{ text-align: left; }
.textPreview[data-align="right"]{ text-align: right; }
.textPreview[data-align="center"]{ text-align: center; }
.textInput{
  width: 100%;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--border2);
  background: rgba(233, 238, 247, 0.06);
  color: var(--text);
  padding: 0 12px;
  outline: none;
}
.textInput--area{
  height: auto;
  min-height: 104px; /* ~4 lines + padding */
  padding: 10px 12px;
  line-height: 1.25;
  resize: none;
}

.iconBtn--sq{
  width: 44px;
  height: 44px;
  border-radius: 12px;
}

.textToolsPopWrap{
  position: relative;
  display: inline-flex;
}
.miniPopover{
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(320px, calc(100vw - 24px));
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(11, 13, 16,0.95);
  box-shadow: 0 18px 60px rgba(0,0,0,0.55);
  padding: 12px;
  z-index: 50;
  box-sizing: border-box;
}
.selectLike{
  height: 44px;
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border2);
  background: rgba(233, 238, 247, 0.06);
  color: var(--text);
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  font-weight: 800;
}
.selectLike .chev{ color: var(--muted); font-weight: 900; display: inline-flex; align-items: center; }

.fontsList{
  margin-top: 10px;
  border-radius: 14px;
  border: 1px solid var(--border);
  overflow: hidden;
}
.fontRow{
  padding: 12px 12px;
  border-top: 1px solid var(--border);
  background: rgba(233,238,247,0.03);
  cursor: pointer;
}
.fontRow:first-child{ border-top: 0; }
.fontRow:hover{ background: rgba(233,238,247,0.06); }
.fontMeta{
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.fontPreview{
  margin-top: 8px;
  font-size: 30px;
  color: rgba(233,238,247,0.92);
  line-height: 1.05;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.num {
  width: 64px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border2);
  background: rgba(233, 238, 247, 0.06);
  color: var(--text);
  padding: 0 10px;
}

.btn {
  height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--border2);
  background: var(--btn);
  color: var(--text);
  cursor: pointer;
  user-select: none;
}
.btn--withIcon{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
}
.btn--withIcon .icon{ width: 18px; height: 18px; }
.btn:hover { background: var(--btnHover); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn:disabled:hover { background: var(--btn); }
.btn--primary {
  border-color: rgba(139,61,255,1.0);
  background: rgba(139,61,255,1.0);
}
.btn--primary:hover { background:  rgba(139,61,255,0.85); }
.btn--primary:disabled:hover { background: rgba(139,61,255,1.0); }
.btn--selected { background: var(--btnActive); border-color: rgba(139,61,255,0.55); }

.btn--full{
  width: 100%;
  justify-content: center;
}

.btn--mt{
  margin-top: 10px;
}

.downloadHint{
  margin-top: 8px;
  color: rgba(233,238,247,0.62);
  font-size: 12px;
  line-height: 1.3;
}

.colorSwatchBtn{
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid var(--border2);
  background: rgba(233,238,247,0.04);
  padding: 0;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.colorSwatchBtn:hover{ background: rgba(233,238,247,0.07); }
.colorSwatchBtn:disabled{ opacity: 0.45; cursor: not-allowed; }
.colorSwatchBtn:disabled:hover{ background: rgba(233,238,247,0.04); }
.colorSwatch{
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #8B3DFF;
  box-shadow: 0 10px 22px rgba(0,0,0,0.25);
  border: 1px solid rgba(255,255,255,0.18);
}

.colorTop{ position: relative; width: 100%; }
.colorPopover{
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  /* Constrain to the sidebar width (not the viewport) so it never goes off-screen */
  width: min(360px, 100%);
  max-width: 100%;
  box-sizing: border-box;
  margin-top: 0;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--border2);
  background: rgba(11, 13, 16, 0.75);
  backdrop-filter: blur(10px);
  box-shadow: 0 18px 60px rgba(0,0,0,0.45);
  z-index: 30;
}

/* Custom color picker */
.cp{
  display: grid;
  gap: 12px;
}
.cp__svWrap{
  position: relative;
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border2);
  background: rgba(233, 238, 247, 0.06);
}
.cp__sv{
  width: 100%;
  height: 160px;
  display: block;
  cursor: crosshair;
}
.cp__knob{
  position: absolute;
  left: 50%;
  top: 50%;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 2px solid rgba(255,255,255,0.95);
  box-shadow:
    0 10px 22px rgba(0,0,0,0.35),
    0 0 0 3px rgba(0,0,0,0.25);
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.cp__row{
  display: grid;
  gap: 8px;
}
.cp__hue{
  /* override the default "filled accent" track so there is no progress/trail */
  --range-pct: 0%;
}
/* Use higher specificity than input[type="range"] so this wins */
input[type="range"].cp__hue::-webkit-slider-runnable-track{
  background: linear-gradient(
    to right,
    #ff0000 0%,
    #ffff00 17%,
    #00ff00 33%,
    #00ffff 50%,
    #0000ff 67%,
    #ff00ff 83%,
    #ff0000 100%
  );
}
input[type="range"].cp__hue::-moz-range-track{
  background: linear-gradient(
    to right,
    #ff0000 0%,
    #ffff00 17%,
    #00ff00 33%,
    #00ffff 50%,
    #0000ff 67%,
    #ff00ff 83%,
    #ff0000 100%
  );
}
input[type="range"].cp__hue::-moz-range-progress{
  /* Firefox draws progress as a separate layer; disable it so the full gradient shows */
  background: transparent;
}
.cp__bottom{
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px;
  align-items: center;
}
.cp__preview{
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border2);
  background: #8B3DFF;
}
.cp__hex{
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border2);
  background: rgba(233, 238, 247, 0.06);
  color: var(--text);
  padding: 0 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.stage { min-width: 0; min-height: 0; display: flex; }
.stage__inner { flex: 1; padding: 0; min-height: 0; min-width: 0; }
.viewport {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 420px;
  border-radius: 0;
  border: 0;
  overflow: hidden;
  /* Checker/gray-squares background so transparency is visible behind the canvas */
  background-color: rgba(11, 13, 16, 0.8);
  background-image: repeating-conic-gradient(
    rgba(233, 238, 247, 0.06) 0 25%,
    rgba(0, 0, 0, 0.10) 0 50%
  );
  background-size: 22px 22px;
  box-shadow: none;
}

#glCanvas, #overlayCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

#glCanvas{ z-index: 1; }
#overlayCanvas{ z-index: 2; }

.loadingOverlay{
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  pointer-events: none;
  background: transparent;
}
.loadingOverlay__content{
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 18px 22px;
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.8);
}
.loadingOverlay__spinner{
  width: 56px;
  height: 56px;
  display: block;
  border-radius: 999px;
  border: 4px solid rgba(255,255,255,0.2);
  border-top-color: #ffffff;
  box-shadow: 0 18px 60px rgba(0,0,0,0.35);
  will-change: transform;
  transform: translateZ(0);
  backface-visibility: hidden;
  animation: spin 0.9s linear infinite;
}
.loadingOverlay__label{
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* Download button loading state: show spinner/progress, hide download icon */
#dlDownload[aria-busy="true"] .dlDownloadIcon { display: none; }
#dlDownload .dlDownloadSpinner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  position: relative;
}
#dlDownload .dlDownloadSpinner .icon--progress {
  position: absolute;
  inset: 0;
  width: 18px;
  height: 18px;
  pointer-events: none;
  animation: spin 1.2s linear infinite;
}
#dlDownload .dlDownloadSpinner .icon--progress .dlDownloadProgressFill { transition: stroke-dashoffset 0.15s ease-out; }

#overlayCanvas {
  pointer-events: auto;
  touch-action: none;
  cursor: crosshair;
  border: 0;
}

/* Only show the canvas boundary when an image is loaded */
:scope.has-image #overlayCanvas{
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Hide native cursor when the custom blur-lens cursor is active */
:scope.cursorLens #overlayCanvas{ cursor: none; }

.cursorPreview{
  position: absolute;
  left: 0;
  top: 0;
  width: 50px;
  height: 50px;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  pointer-events: none;
  z-index: 3;
  --cursor-fade-blur: 0px;
  --cursor-rgb: 139, 61, 255;
  --cursor-alpha: 0.5;
}

.cursorPreview__fill{
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: rgba(var(--cursor-rgb), var(--cursor-alpha));
  /* Match mask fade: a blurred solid stamp (Gaussian-like), not a linear/gradient fade */
  filter: blur(var(--cursor-fade-blur));
  transform: translateZ(0);
}

.cursorPreview__ring{
  position: absolute;
  inset: 0;
  border-radius: 999px;
  box-sizing: border-box;
  border: 2px dashed rgba(233, 238, 247, 0.72);
  box-shadow: 0 10px 30px rgba(0,0,0,0.22);
}

.empty {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  text-align: center;
  pointer-events: none;
  background: radial-gradient(600px 420px at 50% 40%, rgba(139,61,255,0.12), transparent 60%);
}

.emptyCard{
  width: min(440px, calc(100vw - 36px));
  border-radius: 18px;
  border: 1px solid rgba(233,238,247,0.14);
  background: rgba(11, 13, 16, 0.55);
  box-shadow: 0 18px 60px rgba(0,0,0,0.35);
  padding: 18px 18px 16px;
  backdrop-filter: blur(10px);
}
.emptyCard .betaPill{ margin-bottom: 12px; }
.emptyCard__title{ font-weight: 950; font-size: 20px; letter-spacing: 0.01em; }
.emptyCard__sub{ margin-top: 8px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.emptyCard__hint{ margin-top: 10px; color: rgba(233,238,247,0.55); font-size: 12px; }
.emptyCard__file{ width: 100%; }

/* Empty state layout: centered uploader, no sidebar, no stage padding/border */
:scope:not(.has-image) .main { grid-template-columns: 1fr; }
:scope:not(.has-image) .panel { display: none; }
:scope:not(.has-image) .stage__inner { padding: 0; }
:scope:not(.has-image) .viewport{
  min-height: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}
:scope:not(.has-image) .empty{
  pointer-events: auto;
  background: transparent;
  cursor: default;
}
:scope:not(.has-image) #glCanvas,
:scope:not(.has-image) #overlayCanvas{
  visibility: hidden;
}

/* Extra safety: when no image is loaded, always keep a normal cursor */
:scope:not(.has-image) #overlayCanvas{ cursor: default; }
:scope:not(.has-image).cursorLens #overlayCanvas{ cursor: default; }

/* Edit-mask mode: normal cursor */
:scope.edit-mode #overlayCanvas{ cursor: default; }
:scope.edit-mode.cursorLens #overlayCanvas{ cursor: default; }

/* Edit-mask mode: never show the paint cursor preview ring */
:scope.edit-mode .cursorPreview{ display: none !important; }

/* Fullscreen drag overlay */
.globalDropOverlay{
  position: fixed;
  inset: 0;
  z-index: 999;
  display: grid;
  place-items: center;
  background: rgba(139, 61, 255, 0.35);
  backdrop-filter: blur(10px);
}
.globalDropOverlay__inner{
  text-align: center;
  font-weight: 1000;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-size: clamp(32px, 5vw, 74px);
  line-height: 0.95;
  color: rgba(255,255,255,0.96);
  text-shadow: 0 18px 60px rgba(0,0,0,0.45);
  padding: 0 18px;
}

/* Carousel (effect cards) */
.carouselWrap {
  --carousel-gap: 12px;
  --carousel-nav-w: 40px;
  position: relative;
  display: block;
  margin-top: 10px;

  /* Full-bleed inside the padded section: carousel touches the card edges,
     but content above/below keeps the section padding. */
  margin-left: -12px;
  margin-right: -12px;
  padding-left: 10px;
  padding-right: 10px;
  background: linear-gradient(180deg, rgba(11,13,16,0) 0%, rgba(11,13,16,0.55) 100%);
}

.carouselBtn {
  position: absolute;
  top: 0;
  bottom: 0;
  width: var(--carousel-nav-w);
  border: 0;
  border-radius: 0;
  background: transparent;
  color: rgba(233,238,247,0.96);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
}
#carouselPrev.carouselBtn,
#shapeCarouselPrev.carouselBtn{
  left: 0;
  background: linear-gradient(90deg, rgba(11, 13, 16,1.0) 10%, rgba(11, 13, 16,0.0) 100%);
  margin-left: 10px;
}
#carouselNext.carouselBtn,
#shapeCarouselNext.carouselBtn{
  right: 0;
  background: linear-gradient(270deg, rgba(11, 13, 16,1.0) 10%, rgba(11, 13, 16,0.0) 100%);
  margin-right: 10px;
}
.carouselBtn:hover { filter: brightness(1.05); }
.carouselBtn:disabled:hover { filter: none; }
.carousel {
  display: flex;
  gap: var(--carousel-gap);
  overflow-x: auto;
  scroll-behavior: smooth;
  padding: 0;
  scroll-snap-type: x mandatory;
  scroll-padding-left: 0px;
  scrollbar-width: none;
  position: relative;
  z-index: 1;
}
.carousel::-webkit-scrollbar{ display: none; }
.shapeCard{
  flex: 0 0 calc((100% - (var(--carousel-gap) * 2)) / 3);
  scroll-snap-align: start;
}
.shapeCard .shapeBtn{ width: 100%; }
.effectCard {
  flex: 0 0 calc((100% - (var(--carousel-gap) * 2)) / 3);
  cursor: pointer;
  scroll-snap-align: start;
}
.effectFrame {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 18px;
  border: 2px solid transparent; /* keep thickness stable; invisible when not selected */
  background: rgba(233,238,247,0.05);
  overflow: hidden;
  padding: 0;
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}
.effectFrame--selected {
  border-color: var(--accent);
  transform: scale(0.93);
  box-shadow: 0 10px 22px rgba(139,61,255,0.12);
}
.effectThumb {
  width: 100%;
  height: 100%;
  border-radius: 16px; /* slight inset so the border reads cleanly */
  background: rgba(0,0,0,0.15);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.effectThumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}
.effectLabel {
  text-align: center;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

/* Sidebar modal (More settings) */
.sidebarModal {
  position: absolute;
  inset: 0;
  z-index: 20;
  background: rgba(11, 13, 16, 0.92);
  backdrop-filter: blur(10px);
  display: grid;
  grid-template-rows: auto 1fr;
  border-left: 0;
}
.sidebarModal__header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
}
.sidebarModal__title { font-weight: 900; }
.sidebarModal__body { padding: 14px; overflow: auto; }

.iconBtn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(233,238,247,0.04);
  color: var(--text);
  cursor: pointer;
  display: grid;
  place-items: center;
}
.iconBtn:hover { background: rgba(233,238,247,0.07); }
.iconBtn:disabled:hover { background: rgba(233,238,247,0.04); }

/* Allow icon buttons (e.g. Radial center target) to show the same "selected" styling as normal buttons */
.iconBtn.btn--selected{
  background: var(--btnActive);
  border-color: rgba(139,61,255,0.55);
}
.iconBtn.btn--selected .icon--muted{
  color: var(--text);
}

.icon{
  width: 18px;
  height: 18px;
  display: block;
}
.icon--muted{ color: var(--muted); }
.carouselBtn .icon{ width: 20px; height: 20px; }

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
}
/* Bootstrap hides every .modal by default; reveal editor modals after JS removes hidden. */
.modal:not([hidden]) { display: block; }
.modal[hidden] { display: none !important; }
.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
}
.modal__card {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(520px, calc(100vw - 24px));
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(11, 13, 16, 0.92);
  box-shadow: 0 18px 60px rgba(0,0,0,0.55);
}
.modal__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.modal__title { font-weight: 900; }
.modal__body { padding: 14px; }
.modal__error {
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--color-error-bg, rgba(220, 53, 69, 0.12));
  color: var(--color-error, #c92a2a);
  border-radius: 8px;
  font-size: 0.9rem;
}
.modal__error[hidden] { display: none !important; }
.modal__preview {
  margin-top: 10px;
  font-size: 0.85rem;
}
.modal__preview[hidden] { display: none !important; }
.modal__preview summary { cursor: pointer; }
.modal__preview pre {
  margin: 8px 0 0;
  padding: 10px;
  max-height: 280px;
  overflow: auto;
  background: var(--color-bg-secondary, #f1f3f5);
  border-radius: 6px;
  white-space: pre-wrap;
  word-break: break-word;
}
.modal__footer {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: center;
  gap: 10px;
}

/* Custom dropdown (for Download format) */
.prettySelect{ position: relative; }
.prettySelectBtn{
  width: 100%;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border2);
  background: rgba(233, 238, 247, 0.06);
  color: var(--text);
  padding: 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  font-weight: 800;
}
.prettySelectBtn:hover{ background: rgba(233,238,247,0.10); }
.prettySelectBtn:focus{
  outline: none;
  border-color: rgba(139,61,255,0.75);
  box-shadow: 0 0 0 4px rgba(139,61,255,0.18);
}
.prettySelectMenu{
  position: fixed; /* positioned via JS so it can't be clipped by overflow containers */
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(11, 13, 16,0.95);
  box-shadow: 0 18px 60px rgba(0,0,0,0.55);
  padding: 6px;
  z-index: 80;
  max-height: 240px;
  overflow: auto;
}
.modal .prettySelectMenu{
  position: absolute; /* modal card is transformed; fixed menus inside it get mis-positioned */
  left: 0;
  right: 0;
  top: calc(100% + 8px);
  width: auto !important;
  z-index: 90;
}
.prettySelectItem{
  width: 100%;
  height: 34px;
  border-radius: 10px;
  border: 0;
  background: transparent;
  color: rgba(233,238,247,0.92);
  cursor: pointer;
  text-align: left;
  padding: 0 10px;
  font-weight: 800;
}
.prettySelectItem:hover{ background: rgba(233,238,247,0.08); }
.prettySelectItem[aria-selected="true"]{
  background: rgba(139,61,255,0.22);
  color: rgba(233,238,247,0.98);
}

@media (max-width: 980px) {
  .main { grid-template-columns: 1fr; }
  .panel { border-right: 0; border-bottom: 1px solid var(--border); }
}


}
