.custom-page .topbar {
  top: 18px;
}

.custom-main {
  display: grid;
  gap: clamp(34px, 5vw, 64px);
  padding-bottom: 96px;
}

.custom-hero,
.custom-builder {
  width: var(--section-width);
  margin: 0 auto;
}

.custom-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.92fr);
  gap: clamp(22px, 4vw, 42px);
  padding-top: clamp(30px, 7vw, 82px);
}

.custom-builder {
  display: grid;
  grid-template-columns: minmax(310px, 400px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.custom-editor,
.custom-preview {
  align-self: start;
}

.custom-editor {
  display: grid;
  gap: 18px;
}

.custom-editor h2 {
  margin: 4px 0 0;
  font-family: var(--cn-title-font);
  font-size: clamp(1.7rem, 3vw, 2.24rem);
  font-weight: 400;
  letter-spacing: 0.08em;
}

.custom-editor__lede {
  margin: 0;
  color: var(--muted-strong);
  line-height: 1.82;
}

.custom-form {
  display: grid;
  gap: 16px;
}

.custom-form__section {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(115, 242, 255, 0.12);
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.03), transparent 24%),
    rgba(6, 10, 18, 0.62);
}

.custom-form__section h3 {
  margin: 0;
  font-family: var(--mono-font);
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--cyan);
}

.custom-form__section p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.custom-form__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.custom-form__grid--triple {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.custom-form__section .field textarea,
.custom-form__section .field select,
.custom-form__section .field input {
  width: 100%;
  min-height: 54px;
  padding: 14px 16px;
  border: 1px solid rgba(115, 242, 255, 0.16);
  background: rgba(5, 10, 18, 0.72);
  color: var(--text);
  clip-path: polygon(0 12px, 12px 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 0 100%);
  transition: border-color 0.22s ease, box-shadow 0.22s ease;
}

.custom-form__section .field textarea {
  min-height: 124px;
  resize: vertical;
}

.custom-form__section .field select {
  appearance: none;
}

.custom-form__section .field input::placeholder,
.custom-form__section .field textarea::placeholder {
  color: color-mix(in srgb, var(--muted) 82%, transparent);
}

.custom-form__section .field textarea:focus-visible,
.custom-form__section .field select:focus-visible,
.custom-form__section .field input:focus-visible {
  outline: none;
  border-color: rgba(115, 242, 255, 0.42);
  box-shadow: 0 0 0 1px rgba(115, 242, 255, 0.14);
}

.custom-form__hint {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.65;
}

.custom-form__toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.custom-upload-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.custom-upload-trigger {
  position: relative;
  overflow: hidden;
}

.custom-upload-trigger input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.custom-image-editor {
  display: grid;
  gap: 12px;
  justify-items: start;
}

.custom-image-editor__frame {
  justify-self: start;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.custom-image-editor__frame:active {
  cursor: grabbing;
}

.custom-image-editor__frame.is-empty {
  cursor: default;
}

.custom-image-editor__frame.has-custom-image img,
.menu-sheet__image-frame.has-custom-image img {
  position: absolute;
  top: 50%;
  left: 50%;
  width: auto;
  height: auto;
  min-height: 0;
  max-width: none;
  max-height: none;
  object-fit: initial;
  object-position: center;
  transform-origin: center;
}

.custom-image-editor__placeholder {
  z-index: 1;
  max-width: 11ch;
  padding: 12px;
  text-align: center;
  color: color-mix(in srgb, var(--muted) 84%, white 16%);
  font-size: 0.72rem;
  line-height: 1.6;
}

.custom-image-editor__zoom-field {
  width: min(100%, 280px);
}

.custom-image-editor__zoom-field input[type="range"] {
  min-height: auto;
  padding: 0;
  clip-path: none;
}

.menu-sheet__image-frame.has-custom-image {
  background:
    radial-gradient(circle at center, var(--drink-accent-soft), transparent 62%),
    linear-gradient(165deg, rgba(8, 12, 18, 0.82), rgba(14, 19, 28, 0.82));
}

.menu-sheet__image-frame.has-custom-image img {
  filter: none;
}

.menu-sheet__image-frame img.is-custom-image,
.custom-image-editor__frame img.is-custom-image {
  filter: none !important;
}

.custom-preview {
  display: grid;
  gap: 20px;
  justify-items: center;
}

.custom-preview__head {
  width: min(100%, 430px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.custom-preview__head .deck-card__eyebrow {
  margin: 0;
}

.custom-preview__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.custom-preview__actions .primary-button,
.custom-preview__actions .ghost-button {
  min-height: 48px;
  padding-inline: 16px;
}

.custom-preview__sheet {
  width: 100%;
  display: grid;
  justify-items: center;
}

.custom-preview__status {
  width: min(100%, 430px);
  margin: 0;
  color: var(--muted);
  line-height: 1.72;
}

.custom-page .menu-sheet,
.custom-page .menu-generator-card {
  justify-self: center;
}

.mobile-splitbar {
  display: none;
}

@media (max-width: 1024px) {
  .custom-builder {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .custom-page .custom-main {
    padding-bottom: 126px;
  }

  .custom-hero {
    grid-template-columns: 1fr;
  }

  .custom-form__grid,
  .custom-form__grid--triple {
    grid-template-columns: 1fr;
  }

  .custom-preview__head,
  .custom-preview__status {
    width: 100%;
  }

  .custom-image-editor__zoom-field {
    width: 100%;
  }

  .custom-builder {
    gap: 16px;
  }

  [data-mobile-pane].is-mobile-hidden {
    display: none;
  }

  .mobile-splitbar {
    position: fixed;
    left: 50%;
    bottom: max(12px, env(safe-area-inset-bottom, 0px));
    z-index: 28;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    width: min(calc(100% - 20px), 420px);
    padding: 8px;
    transform: translateX(-50%);
    border: 1px solid rgba(115, 242, 255, 0.16);
    background: rgba(6, 10, 18, 0.86);
    box-shadow:
      0 0 0 1px rgba(255, 255, 255, 0.02) inset,
      0 20px 42px rgba(0, 0, 0, 0.34);
    backdrop-filter: blur(14px);
    clip-path: polygon(0 12px, 12px 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 12px));
  }

  .mobile-splitbar__button {
    min-height: 46px;
    padding: 0 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(12, 18, 28, 0.74);
    color: var(--muted-strong);
    font-family: var(--mono-font);
    font-size: 0.76rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    cursor: pointer;
    clip-path: polygon(0 10px, 10px 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
    transition: background 0.22s ease, border-color 0.22s ease, color 0.22s ease, transform 0.22s ease;
  }

  .mobile-splitbar__button.is-active {
    background: linear-gradient(135deg, rgba(115, 242, 255, 0.18), rgba(115, 242, 255, 0.08));
    border-color: rgba(115, 242, 255, 0.28);
    color: var(--text);
    box-shadow: 0 0 24px rgba(115, 242, 255, 0.08);
  }
}
