:root{
  --bg: #000;
  --panel: rgba(255,255,255,0.06);
  --panel2: rgba(255,255,255,0.08);
  --stroke: rgba(255,255,255,0.12);
  --text: rgba(255,255,255,0.92);
  --muted: rgba(255,255,255,0.65);
  --muted2: rgba(255,255,255,0.5);
  --shadow: 0 18px 60px rgba(0,0,0,0.55);
  --radius: 18px;
  --radius2: 22px;
  --gap: 16px;
  --font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Apple Color Emoji","Segoe UI Emoji";
}

*{ box-sizing: border-box; }
html{ scroll-behavior: smooth; }
html,body{ margin:0; }
body{
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

/* ===== Landing ===== */
.landing{
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
  transition: opacity 0.7s ease, visibility 0.7s ease;
}
.landing-out{
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.landing::before{
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% 110%, rgba(130,90,255,0.18) 0%, transparent 70%),
    radial-gradient(ellipse 60% 40% at 20% 80%, rgba(60,180,255,0.10) 0%, transparent 60%),
    radial-gradient(ellipse 50% 35% at 80% 75%, rgba(255,120,180,0.09) 0%, transparent 55%);
  pointer-events: none;
}
.landing-inner{
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 40px 24px;
  max-width: 640px;
}
.landing-title{
  font-family: 'Cormorant Garamond', Garamond, 'Times New Roman', Georgia, serif;
  font-size: clamp(80px, 16vw, 160px);
  font-weight: 300;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin: 0;
  line-height: 1;
  background: linear-gradient(160deg, #fff 30%, rgba(200,170,255,0.85) 70%, rgba(140,210,255,0.7) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.landing-subtitle{
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.55em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.38);
}
.landing-desc{
  margin: 12px 0 0;
  font-family: 'Cormorant Garamond', Garamond, Georgia, serif;
  font-size: clamp(15px, 2vw, 18px);
  font-style: italic;
  font-weight: 300;
  line-height: 1.85;
  color: rgba(255,255,255,0.48);
  max-width: 640px;
}
.landing-btn{
  margin-top: 20px;
  padding: 13px 42px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.22);
  color: rgba(255,255,255,0.65);
  font-family: var(--font);
  font-size: 11px;
  letter-spacing: 0.45em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 2px;
  transition: border-color 0.3s, color 0.3s, background 0.3s;
}
.landing-btn:hover{
  border-color: rgba(255,255,255,0.55);
  color: rgba(255,255,255,0.95);
  background: rgba(255,255,255,0.05);
}
.landing-arrow{
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  animation: landing-pulse 2.2s ease-in-out infinite;
}
.landing-arrow::before,
.landing-arrow::after{
  content: '';
  display: block;
  width: 10px;
  height: 10px;
  border-right: 1.5px solid rgba(255,255,255,0.5);
  border-bottom: 1.5px solid rgba(255,255,255,0.5);
  transform: rotate(45deg);
}
@keyframes landing-pulse{
  0%,100%{ opacity: 0.25; transform: translateX(-50%) translateY(0); }
  50%{ opacity: 0.75; transform: translateX(-50%) translateY(5px); }
}

h1{
  margin:0;
  font-size: 16px;
  letter-spacing: 0.2px;
}
.panel-title{
  font-family: 'Cormorant Garamond', Garamond, 'Times New Roman', Georgia, serif;
  font-size: 56px;
  font-weight: 300;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  line-height: 1;
  margin: 0 0 22px;
  background: linear-gradient(160deg, #fff 30%, rgba(200,170,255,0.85) 70%, rgba(140,210,255,0.7) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  width: 100%;
}
.layout{
  display:grid;
  grid-template-columns: 300px 1fr;
  height: 100svh;
  min-height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(ellipse 90% 55% at 50% -5%,  rgba(110, 70, 240, 0.16) 0%, transparent 65%),
    radial-gradient(ellipse 65% 50% at 10% 20%,  rgba(60, 160, 255, 0.11) 0%, transparent 60%),
    radial-gradient(ellipse 55% 45% at 90% 25%,  rgba(220, 90, 190, 0.09) 0%, transparent 55%),
    radial-gradient(ellipse 80% 50% at 50% 105%, rgba(100, 60, 220, 0.12) 0%, transparent 65%),
    var(--bg);
}
@media (max-width: 800px){
  .layout{ grid-template-columns: 1fr; }
}

.panel{
  background: linear-gradient(180deg, rgba(255,255,255,0.035) 0%, transparent 55%);
  border-right: 1px solid rgba(255,255,255,0.07);
  padding: 28px 18px 14px;
  backdrop-filter: blur(16px);
  height: 100svh;
  overflow-y: auto;
  scrollbar-width: none;
}
.panel::-webkit-scrollbar{ display: none; }

.group{ margin-bottom: 18px; }
.label{
  font-family: 'Cormorant Garamond', Garamond, Georgia, serif;
  font-size: 15px;
  font-weight: 400;
  letter-spacing: 0.06em;
  color: rgba(255,255,255,0.52);
  margin-bottom: 8px;
}
.hint{
  margin: 8px 0 0;
  color: var(--muted2);
  font-size: 12px;
  line-height: 1.35;
}
/* ===== Drop zone ===== */
.drop-zone{
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 22px 14px;
  border-radius: 14px;
  border: 1.5px dashed var(--stroke);
  background: rgba(0,0,0,0.15);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  text-align: center;
}
.drop-zone:hover,
.drop-zone.drag-over{
  border-color: rgba(180,155,255,0.55);
  background: rgba(160,130,255,0.07);
}
.drop-zone.drag-over .drop-icon{
  color: rgba(180,155,255,0.9);
  transform: translateY(-2px);
}
.drop-icon{
  width: 32px;
  height: 32px;
  color: var(--muted2);
  transition: color 0.15s, transform 0.15s;
}
.drop-text{
  font-size: 13px;
  color: var(--text);
}
.drop-sub{
  font-size: 11px;
  color: var(--muted2);
  display: flex;
  align-items: center;
  gap: 4px;
}
.drop-zone input[type="file"]{
  display: none;
}

.sep{
  border: none;
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(255,255,255,0.09) 30%, rgba(255,255,255,0.09) 70%, transparent);
  margin: 20px 0;
}

.row{ display:flex; gap: 10px; align-items:center; }
.row-between{ justify-content: space-between; }
.mb-4{ margin-bottom: 4px; }
.btn-full{ width: 100%; }
.mb-6{ margin-bottom: 6px; }

.preset-grid{
  margin-top: 10px;
  display:grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
}
.preset{
  padding: 0;
  border-radius: 8px;
  border: 1px solid var(--stroke);
  background: transparent;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.15s;
  position: relative;
}
.preset img{
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
}
.preset:hover{
  border-color: rgba(255,255,255,0.3);
}
.saved-del{
  position: absolute;
  top: 3px; right: 3px;
  width: 16px; height: 16px;
  background: rgba(0,0,0,0.65);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1;
}
.preset:hover .saved-del{ display: flex; }

.control{
  margin-top: 12px;
}
.control label{
  display:flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 11px;
  letter-spacing: 0.02em;
  color: rgba(255,255,255,0.42);
  margin-bottom: 6px;
}
.value{
  color: var(--text);
  opacity: 0.9;
  font-variant-numeric: tabular-nums;
}
input[type="range"]{
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 18px;          /* klikgebied */
  background: transparent;
  cursor: pointer;
  padding: 0;
  margin: 0;
}
input[type="range"]::-webkit-slider-runnable-track{
  height: 2px;
  background: rgba(255,255,255,0.15);
  border-radius: 2px;
}
input[type="range"]::-webkit-slider-thumb{
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(255,255,255,0.75);
  border: none;
  margin-top: -5px;
  transition: background 0.12s;
}
input[type="range"]:hover::-webkit-slider-thumb{
  background: rgba(255,255,255,0.95);
}
input[type="range"]::-moz-range-track{
  height: 2px;
  background: rgba(255,255,255,0.15);
  border-radius: 2px;
  border: none;
}
input[type="range"]::-moz-range-thumb{
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(255,255,255,0.75);
  border: none;
  transition: background 0.12s;
}
input[type="range"]:hover::-moz-range-thumb{
  background: rgba(255,255,255,0.95);
}

.btn{
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.72);
  font-family: var(--font);
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s, color 0.18s;
  font-variant-emoji: text;
}
.btn:hover{
  border-color: rgba(255,255,255,0.22);
  background: rgba(255,255,255,0.10);
  color: rgba(255,255,255,0.95);
}
.btn-ghost{
  background: transparent;
  border-color: rgba(255,255,255,0.09);
}
.btn-ghost:hover{
  background: rgba(255,255,255,0.06);
}
.btn-active{
  background: rgba(180,150,255,0.16);
  border-color: rgba(180,155,255,0.38);
  color: rgba(255,255,255,0.92);
}
.btn-sm{
  padding: 6px 10px;
  font-size: 11px;
  letter-spacing: 0.02em;
}

.stage{
  display:flex;
  flex-direction: column;
  height: 100vh;
  padding: 14px;
  gap: 10px;
}
.canvas-wrap{
  position: relative;
  border-radius: var(--radius2);
  background: transparent;
  overflow:hidden;
  flex: 1;
  min-height: 0;
}
.canvas-wrap.bg-checker{
  background: repeating-conic-gradient(#2a2a2a 0% 25%, #3a3a3a 0% 50%) 0 0 / 20px 20px;
}
canvas{
  display:block;
  width: 100%;
  height: 100%;
}
.overlay{
  position: absolute;
  inset: 12px 12px auto auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
}
.overlay > *{
  pointer-events: auto;
}
.pill{
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: rgba(0,0,0,0.35);
  color: var(--muted);
  font-size: 12px;
  backdrop-filter: blur(8px);
}

/* ===== Mode tabs ===== */
.mode-tabs{
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin-top: 8px;
}
.mode-btn{
  padding: 7px 2px;
  border-radius: 7px;
  border: 1px solid rgba(255,255,255,0.07);
  background: transparent;
  color: rgba(255,255,255,0.38);
  cursor: pointer;
  font-size: 11px;
  font-family: var(--font);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.mode-btn:hover{
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.75);
  border-color: rgba(255,255,255,0.14);
}
.mode-btn.mode-active{
  background: rgba(155,125,255,0.16);
  border-color: rgba(175,150,255,0.42);
  color: rgba(255,255,255,0.92);
}

/* ===== Animation actions row ===== */
.anim-actions{
  display: flex;
  gap: 8px;
  margin-top: 14px;
}
.anim-actions .btn{ flex: 1; text-align: center; }

/* ===== XY pad ===== */
.xy-pad{
  position: relative;
  width: 100%;
  height: 100px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 10px;
  cursor: crosshair;
  overflow: hidden;
  margin-top: 14px;
  touch-action: none;
}
.xy-crosshair{
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to right,
      transparent calc(50% - 0.5px),
      rgba(255,255,255,0.1) calc(50% - 0.5px),
      rgba(255,255,255,0.1) calc(50% + 0.5px),
      transparent calc(50% + 0.5px)),
    linear-gradient(to bottom,
      transparent calc(50% - 0.5px),
      rgba(255,255,255,0.1) calc(50% - 0.5px),
      rgba(255,255,255,0.1) calc(50% + 0.5px),
      transparent calc(50% + 0.5px));
  pointer-events: none;
}
.xy-dot{
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(255,255,255,0.85);
  border: 1.5px solid rgba(255,255,255,0.4);
  box-shadow: 0 2px 10px rgba(0,0,0,0.5);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

/* ===== Achtergrond swatches ===== */
.bg-row{
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 6px;
}
.bg-swatch{
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 1.5px solid rgba(255,255,255,0.2);
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.bg-swatch.bg-active{
  border-color: rgba(255,255,255,0.7);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.25);
}
.bg-swatch-dark        { background: #0b0f14; }
.bg-swatch-light       { background: #f0ece6; }
.bg-swatch-transparent { background: repeating-conic-gradient(#888 0% 25%, #ccc 0% 50%) 0 0 / 8px 8px; }
#bgColorInput          { display: none; }

/* ===== Source tabs (presets / upload) ===== */
.source-tabs{
  display: flex;
  gap: 4px;
  margin-bottom: 10px;
}
.source-tab{
  flex: 1;
  padding: 6px 0;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.08);
  background: transparent;
  color: rgba(255,255,255,0.38);
  cursor: pointer;
  font-size: 11px;
  letter-spacing: 0.04em;
  font-family: var(--font);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.source-tab.source-tab-active{
  background: rgba(255,255,255,0.07);
  border-color: rgba(255,255,255,0.18);
  color: rgba(255,255,255,0.85);
}
.source-panel{ display: block; }
.source-hidden{ display: none; }

/* ===== Collapsible sections ===== */
.group-header{
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}
.group-header .label{ margin-bottom: 0; flex: 1; }
.collapse-btn{
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  background: none;
  color: var(--muted2);
  cursor: pointer;
  font-size: 12px;
  line-height: 22px;
  text-align: center;
  flex-shrink: 0;
  transition: transform 0.2s, color 0.12s;
  border-radius: 4px;
}
.collapse-btn:hover{ color: var(--text); }
.group.collapsed .collapse-btn{ transform: rotate(-90deg); }
.collapsible{
  overflow: hidden;
  max-height: 800px;
  transition: max-height 0.3s ease;
}
.group.collapsed .collapsible{ max-height: 0; }

/* ===== Settings sub-labels ===== */
.sub-label{
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: rgba(255,255,255,0.28);
  margin: 18px 0 4px;
}
.sub-label:first-child{ margin-top: 6px; }

/* ===== Sticky bottom actions ===== */
.panel-actions{
  position: sticky;
  bottom: 0;
  margin: 14px -18px -14px;
  padding: 12px 18px 18px;
  background: rgba(0,0,0,0.72);
  backdrop-filter: blur(18px);
  border-top: 1px solid rgba(255,255,255,0.07);
}

/* ===== Info tooltip ===== */
.info-tip{
  position: relative;
  display: inline-flex;
  align-items: center;
  color: var(--muted2);
  cursor: default;
  font-size: 11px;
  margin-left: 4px;
}
.tip-text{
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(18,22,32,0.97);
  border: 1px solid var(--stroke);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 11px;
  color: var(--muted);
  white-space: normal;
  max-width: 210px;
  line-height: 1.45;
  text-align: center;
  pointer-events: none;
  z-index: 10;
}
.info-tip:hover .tip-text,
.info-tip:focus .tip-text{ display: block; }

/* ===== Keyboard hint ===== */
.kbd-hint{
  font-size: 10px !important;
  opacity: 0.45;
  margin-top: 6px !important;
}

/* ===== Shortcuts modal ===== */
.shortcuts-modal{
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.72);
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
}
.shortcuts-modal.open{ display: flex; }
.shortcuts-box{
  background: rgba(18,22,32,0.97);
  border: 1px solid var(--stroke);
  border-radius: 18px;
  padding: 28px 32px;
  max-width: 460px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}
.shortcuts-box h2{
  margin: 0 0 18px;
  font-family: 'Cormorant Garamond', serif;
  font-size: 22px;
  font-weight: 300;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.85);
}
.shortcuts-table{
  width: 100%;
  border-collapse: collapse;
}
.shortcuts-table td{
  padding: 5px 0;
  font-size: 12px;
  color: rgba(255,255,255,0.65);
  vertical-align: top;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.shortcuts-table tr:last-child td{ border-bottom: none; }
.shortcuts-table td:first-child{
  font-family: ui-monospace, monospace;
  color: rgba(200,170,255,0.85);
  padding-right: 20px;
  white-space: nowrap;
}
.shortcuts-close{
  margin-top: 20px;
  width: 100%;
}
.btn-help{
  padding: 5px 9px;
  font-size: 13px;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font);
}

/* ===== Export scale ===== */
.export-scale{
  padding: 5px 6px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.72);
  font-family: var(--font);
  font-size: 11px;
  cursor: pointer;
}
.export-scale option{
  background: #1a1e2a;
  color: rgba(255,255,255,0.85);
}

/* ===== Mobile nav ===== */
.mobile-nav{
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: rgba(0,0,0,0.88);
  backdrop-filter: blur(12px);
  border-top: 1px solid rgba(255,255,255,0.09);
  padding: 8px 16px;
  gap: 8px;
}
.mobile-nav-btn{
  flex: 1;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.09);
  background: transparent;
  color: rgba(255,255,255,0.5);
  font-family: var(--font);
  font-size: 12px;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.mobile-nav-btn.active{
  background: rgba(155,125,255,0.16);
  border-color: rgba(175,150,255,0.42);
  color: rgba(255,255,255,0.92);
}
@media (max-width: 800px){
  .mobile-nav{ display: flex; }
  .layout{ padding-bottom: 58px; overflow: hidden; }
  .layout[data-view="canvas"] .panel{ display: none; }
  .layout[data-view="controls"] .stage{ display: none; }
}