:root {
  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);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
/* Ensure native `hidden` always hides, even if component classes set display. */
[hidden] { display: none !important; }
body {
  margin: 0;
  font-family: "Space Grotesk", ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  background: radial-gradient(1200px 700px at 20% 0%, rgba(139,61,255,0.22), transparent 60%),
              radial-gradient(900px 600px at 100% 0%, rgba(0,180,255,0.12), transparent 55%),
              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;
  padding: 10px 14px;
  border-radius: 999px;
  background: #893dff;
  color: #fff !important;
}
.appHeaderShell .nav-app-btn.active{ opacity: 0.95; }

@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); }
}

.main { flex: 1; display: grid; grid-template-columns: 330px 1fr; min-height: 0; }

.panel {
  border-right: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(18,23,35,0.9), rgba(15,18,23,0.9));
  overflow: hidden;
  position: relative;
}
.panel__scroll {
  height: 100%;
  overflow: auto;
  padding: 14px;
}
.requiresImage { display: block; }
body:not(.has-image) .requiresImage { display: none; }
.panel__section {
  border: 1px solid var(--border);
  background: rgba(11, 13, 16, 0.35);
  border-radius: 14px;
  padding: 12px;
  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; }

.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(--muted); margin-bottom: 6px; }
.field__value { margin-top: 6px; font-size: 12px; color: var(--muted); }

input[type="range"] { width: 100%; }
.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--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); }

.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: 1fr 1fr 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; }
.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); }

.dropzone {
  border-radius: 14px;
  border: 1px dashed rgba(233,238,247,0.26);
  background: rgba(233,238,247,0.04);
  padding: 12px;
  cursor: pointer;
}
.dropzone:hover { background: rgba(233,238,247,0.06); }
.dropzone--drag {
  border-color: rgba(139,61,255,0.85);
  box-shadow: 0 0 0 2px rgba(139,61,255,0.20) inset;
  background: rgba(139,61,255,0.10);
}
.dropzone__hint{
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
}

.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;
  background: rgba(233,238,247,0.10);
  border: 1px solid rgba(233,238,247,0.14);
  margin: 0 auto;
}
.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);
}

.textPreview{
  margin-top: 10px;
  height: 150px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: #893dff;
  font-weight: 900;
  font-size: 44px;
  letter-spacing: 0.02em;
  text-align: center;
  user-select: none;
}
.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;
}
.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; }

.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: 34px;
  color: rgba(233,238,247,0.92);
  line-height: 1.05;
}

.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:hover { background: var(--btnHover); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn--primary {
  border-color: rgba(139,61,255,0.55);
  background: linear-gradient(180deg, rgba(139,61,255,0.60), rgba(139,61,255,0.45));
  box-shadow: 0 10px 22px rgba(139,61,255,0.20);
}
.btn--primary:hover { background: linear-gradient(180deg, rgba(139,61,255,0.45), rgba(139,61,255,0.26)); }
.btn--selected { background: var(--btnActive); border-color: rgba(139,61,255,0.55); }

.stage { min-width: 0; min-height: 0; display: flex; }
.stage__inner { flex: 1; padding: 14px; min-height: 0; min-width: 0; }
.viewport {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 420px;
  border-radius: 18px;
  border: 2px solid rgba(139,61,255,0.75);
  overflow: hidden;
  background: rgba(0,0,0,0.2);
  box-shadow: 0 10px 30px var(--shadow);
}

#glCanvas, #overlayCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

#overlayCanvas {
  pointer-events: auto;
  touch-action: none;
  cursor: crosshair;
}

.empty {
  position: absolute;
  inset: 0;
  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%);
}
.empty__title { font-weight: 800; font-size: 18px; }
.empty__sub { margin-top: 6px; color: var(--muted); font-size: 13px; }

/* Carousel (effect cards) */
.carouselWrap {
  display: grid;
  grid-template-columns: 28px 1fr 28px;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
}
.carouselBtn {
  height: 110px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(233,238,247,0.04);
  color: var(--text);
  cursor: pointer;
}
.carouselBtn:hover { background: rgba(233,238,247,0.07); }
.carousel {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scroll-behavior: smooth;
  padding: 2px;
}
.effectCard {
  width: 106px;
  flex: 0 0 auto;
  cursor: pointer;
}
.effectFrame {
  width: 106px;
  height: 106px;
  border-radius: 14px;
  border: 1px solid var(--border2);
  background: rgba(233,238,247,0.05);
  overflow: hidden;
  padding: 4px;
}
.effectFrame--selected {
  border: 2px solid var(--accent);
  box-shadow: 0 10px 22px rgba(139,61,255,0.12);
}
.effectThumb {
  width: 100%;
  height: 100%;
  border-radius: 10px;
  background: rgba(0,0,0,0.15);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.effectThumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  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;
  border-bottom: 1px solid var(--border);
}
.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;
}
.iconBtn:hover { background: rgba(233,238,247,0.07); }

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
}
.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(18,23,35,0.92);
  box-shadow: 0 18px 60px rgba(0,0,0,0.55);
  overflow: hidden;
}
.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__footer {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

@media (max-width: 980px) {
  .main { grid-template-columns: 1fr; }
  .panel { border-right: 0; border-bottom: 1px solid var(--border); }
}

