* {
  box-sizing: border-box
}

html {
  min-height: 100%;
  background:
    radial-gradient(circle at 18% 20%, rgba(0, 214, 255, .14), transparent 28%),
    radial-gradient(circle at 82% 18%, rgba(84, 132, 255, .12), transparent 24%),
    radial-gradient(circle at 50% 78%, rgba(0, 180, 220, .10), transparent 34%),
    linear-gradient(180deg, #08111b 0%, #0d1621 54%, #08111b 100%);
}

body {
  font-family: system-ui, Segoe UI, Roboto, sans-serif;
  min-height: 100vh;
  background:
    radial-gradient(circle at top, rgba(142, 205, 252, .08), transparent 30%),
    linear-gradient(180deg, rgba(4, 10, 18, .72) 0%, rgba(4, 10, 18, .88) 100%);
  color: #eff3f6;
  margin: 0;
  padding: 2rem 2rem 3rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  overflow-x: hidden;
  position: relative;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body::before {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .05) 0%, rgba(255, 255, 255, 0) 42%),
    linear-gradient(315deg, rgba(71, 140, 255, .10) 0%, rgba(71, 140, 255, 0) 38%);
  opacity: .9;
  z-index: -3;
}

body::after {
  background:
    linear-gradient(rgba(142, 205, 252, .06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(142, 205, 252, .05) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(circle at center, black 26%, transparent 88%);
  opacity: .32;
  z-index: -2;
}

.layout {
  display: flex;
  justify-content: center;
  gap: 1rem;
  width: 100%;
  max-width: 1600px;
}

.card {
  background: rgba(34, 42, 56, .88);
  padding: 1.6rem;
  border-radius: 18px;
  border: 1px solid rgba(142, 205, 252, .12);
  box-shadow:
    0 22px 70px rgba(0, 0, 0, .42),
    inset 0 1px 0 rgba(255, 255, 255, .04);
  backdrop-filter: blur(12px);
  width: 680px;
  flex-shrink: 0;
  transition: margin-left .35s ease;
}

h1 {
  margin: 0 0 1rem 0;
  color: #8ecdfc;
  font-size: 1.2rem;
  font-weight: 600
}

.header-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.6rem
}

.field {
  display: flex;
  flex-direction: column;
  font-weight: 500;
  gap: .35rem
}

.input-wrap {
  display: flex;
  align-items: center;
  gap: .5rem
}

.header-row input,
.header-row select {
  flex: 1 1 auto;
  padding: .45rem .7rem;
  border-radius: 6px;
  border: 1px solid #485260;
  background: #1f242d;
  color: #eff3f6;
  font-size: .95rem
}

.btn-light {
  background: #404956;
  color: #d7dee5;
  border: none;
  border-radius: 6px;
  padding: .35rem .55rem;
  font-size: .8rem;
  cursor: pointer
}

.btn-light:hover {
  background: #525b68
}

.solids-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .6rem
}

h2 {
  margin: 0;
  font-size: 1rem;
  color: #8ecdfc;
  font-weight: 600
}

.btn-reset {
  background: #485260;
  border: none;
  color: #fff;
  font-size: .8rem;
  padding: .3rem .8rem;
  border-radius: 6px;
  cursor: pointer
}

.btn-reset:hover {
  background: #5a6474
}

.solids-row {
  display: grid;
  gap: 1rem;
  margin-bottom: 1rem
}

.five-boxes {
  grid-template-columns: repeat(5, 1fr)
}

.four-boxes {
  grid-template-columns: repeat(4, 1fr)
}

.drop-box {
  background: #1f242d;
  border: 1px dashed #485260;
  border-radius: 8px;
  width: 100%;
  aspect-ratio: 1/1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative
}

.drop-box.over {
  border-style: solid;
  border-color: #8ecdfc
}

.drop-box img {
  width: 80%;
  height: 80%;
  object-fit: contain;
  cursor: grab
}

.badge {
  position: absolute;
  top: 4px;
  left: 4px;
  font-size: .75rem;
  background: #2a7aec;
  color: #fff;
  border-radius: 4px;
  padding: 0 .3rem;
  font-weight: 600
}

.btn-primary {
  display: block;
  margin: 1.2rem auto 0;
  background: #1e66d0;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: .5rem 1.4rem;
  font-weight: 600;
  cursor: pointer;
  font-size: .9rem
}

.btn-primary:hover {
  background: #2a7aec
}

#editor-panel {
  width: 0;
  opacity: 0;
  overflow: hidden;
  flex-shrink: 0;
  background: #29313c;
  border-radius: 12px;
  box-shadow: 0 0 12px rgba(0, 0, 0, .4);
  transition: width .35s ease, opacity .35s ease;
}

#editor-panel.open {
  width: 320px;
  opacity: 1
}

#editor-panel header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.1rem .5rem;
  border-bottom: 1px solid #485260
}

#editor-panel h3 {
  margin: 0;
  font-size: 1rem
}

#close-editor {
  background: none;
  border: none;
  color: #8ecdfc;
  font-size: 1.2rem;
  cursor: pointer
}

#editor-form {
  padding: 1rem 1.1rem
}

#editor-form label {
  display: block;
  margin: .7rem 0;
  font-weight: 500
}

#editor-form input[type=range] {
  width: 100%
}

@keyframes fadeIn {
  from {
    opacity: 0
  }

  to {
    opacity: 1
  }
}

.preview {
  width: 100%;
  max-width: 1600px;
  text-align: center;
  background: rgba(8, 16, 28, .38);
  border: 1px solid rgba(142, 205, 252, .08);
  border-radius: 18px;
  padding: 1.1rem 1.1rem 1.3rem;
  box-shadow: 0 18px 48px rgba(0, 0, 0, .24);
  backdrop-filter: blur(8px)
}

.preview img {
  width: 100%;
  aspect-ratio: 8/1;
  object-fit: cover;
  border: 1px solid rgba(142, 205, 252, .14);
  border-radius: 12px;
  opacity: 0
}

.preview img.visible {
  animation: fadeIn .4s ease forwards
}

@media (max-width:900px) {
  body {
    padding: 1rem 1rem 2rem
  }

  .card {
    width: 100%
  }

  #editor-panel {
    width: 100% !important;
    border-radius: 0 0 12px 12px
  }

  .layout {
    flex-direction: column;
    gap: 1.5rem
  }
}

#download-btn,
#dashmap-btn {
  display: none;
  opacity: 0;
  transform: translateX(80px);
  pointer-events: none;
}

.btn-primary.hollow {
  background: transparent;
  color: #1e66d0;
  border: 2px solid #1e66d0;
}

.btn-primary.hollow:hover {
  background: #1e66d0;
  color: #fff;
}

.preview-header {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: .6rem;
  margin-bottom: .8rem;
}

.preview-note {
  display: inline-flex;
  align-items: center;
  padding: .28rem .7rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(142, 205, 252, .12);
  color: #c8d4de;
  font-size: .82rem;
}

#download-btn,
#dashmap-btn {
  margin: 0
}

#download-btn,
#dashmap-btn {
  opacity: 0;
  transform: translateX(80px);
  pointer-events: none;
}

#download-btn.ready,
#dashmap-btn.ready {
  display: inline-block;
  animation:
    dashIn .45s ease-out forwards,
    dashWiggle .14s ease-in-out .55s 3;
  pointer-events: auto;
}

@keyframes dashIn {
  from {
    opacity: 0;
    transform: translateX(80px)
  }

  to {
    opacity: 1;
    transform: translateX(0)
  }
}

@keyframes dashWiggle {
  0% {
    transform: translateX(0) rotate(0deg)
  }

  50% {
    transform: translateX(2px) rotate(2deg)
  }

  100% {
    transform: translateX(0) rotate(0deg)
  }
}

.btn-primary.hollow {
  background: transparent;
  color: #1e66d0;
  border: 2px solid #1e66d0;
}

.btn-primary.hollow:hover {
  background: #1e66d0;
  color: #fff;
}
