html.editor-open {
  overflow: hidden;
}

#program-editor.editor-dialog {
  box-sizing: border-box;
  width: min(660px, calc(100vw - 40px));
  max-width: none;
  height: min(880px, calc(100dvh - 64px));
  max-height: calc(100dvh - 40px);
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .72);
  border-radius: 28px;
  background: #fafafa;
  color: #171719;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Helvetica Neue", sans-serif;
  box-shadow: 0 32px 100px rgba(0, 0, 0, .4);
  color-scheme: light;
}

#program-editor.editor-dialog[open] {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  animation: editor-arrive .24s cubic-bezier(.2, .8, .2, 1) both;
}

#program-editor::backdrop {
  background: rgba(0, 0, 0, .68);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 29px 32px 22px;
}

.editor-title {
  margin: 0;
  font-size: 27px;
  font-weight: 650;
  line-height: 1.25;
  letter-spacing: -.8px;
}

.editor-close {
  display: grid;
  place-items: center;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  padding: 0 0 3px;
  border: 0;
  border-radius: 50%;
  background: #eaeaec;
  color: #55555b;
  font: 25px/1 -apple-system, BlinkMacSystemFont, sans-serif;
  cursor: pointer;
  transition: background .2s, transform .2s;
}

.editor-close:hover {
  background: #dedee1;
  transform: rotate(90deg);
}

.editor-form {
  display: grid;
  align-content: start;
  gap: 20px;
  min-height: 0;
  margin: 0;
  padding: 2px 32px 28px;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #d5d5d9 transparent;
}

.editor-picker-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding-bottom: 24px;
  border-bottom: 1px solid #e6e6e8;
}

.editor-field {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.editor-label {
  font-size: 13px;
  font-weight: 590;
  line-height: 1.4;
  color: #525258;
}

.editor-input,
.editor-select {
  box-sizing: border-box;
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 46px;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid #dedee2;
  border-radius: 12px;
  background: #fff;
  color: #171719;
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
  transition: border-color .18s, box-shadow .18s;
}

.editor-input::placeholder {
  color: #aaaab0;
}

.editor-input:focus,
.editor-select:focus {
  outline: none;
  border-color: #d82139;
  box-shadow: 0 0 0 3px rgba(216, 33, 57, .09);
}

textarea.editor-input {
  min-height: 130px;
  resize: vertical;
  line-height: 1.75;
}

.editor-cover {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr);
  align-items: start;
  gap: 18px;
}

.editor-cover-preview {
  display: grid;
  place-items: center;
  width: 80px;
  height: 108px;
  overflow: hidden;
  border: 1px solid #e2e2e5;
  border-radius: 12px;
  background: linear-gradient(155deg, #fff, #eeeeef);
}

.editor-cover-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.editor-cover-placeholder {
  color: #b2b2b9;
  font-size: 11px;
  letter-spacing: 2px;
}

.editor-cover-controls {
  display: grid;
  justify-items: start;
  width: 100%;
  gap: 9px;
}

.editor-cover-controls > .editor-field {
  width: 100%;
}

.editor-upload-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 0;
  overflow: hidden;
  color: #c6172e;
  font-size: 12px;
  font-weight: 550;
  cursor: pointer;
}

.editor-upload-input {
  position: absolute;
  inset: 0;
  width: 100%;
  opacity: 0;
  cursor: pointer;
}

.editor-upload-button:focus-within {
  outline: 2px solid #d82139;
  outline-offset: 4px;
  border-radius: 3px;
}

.editor-footer {
  display: grid;
  gap: 9px;
  padding: 12px 32px 25px;
  border-top: 1px solid #e6e6e8;
  background: rgba(250, 250, 250, .96);
}

.editor-status {
  min-height: 18px;
  margin: 0;
  color: #7b7b83;
  font-size: 12px;
  line-height: 1.5;
}

.editor-status-error {
  color: #c6172e;
}

.editor-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.editor-button {
  min-height: 43px;
  padding: 11px 21px;
  border: 0;
  border-radius: 100px;
  font: 550 13px/1.4 -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
  cursor: pointer;
  transition: background .18s, box-shadow .18s, transform .18s;
}

.editor-button-primary {
  background: #d51b33;
  color: #fff;
  box-shadow: 0 3px 10px rgba(197, 20, 43, .13);
}

.editor-button-primary:hover {
  background: #be142b;
  box-shadow: 0 4px 14px rgba(197, 20, 43, .22);
}

.editor-button-secondary {
  background: #ebebed;
  color: #525258;
}

.editor-button-secondary:hover {
  background: #e0e0e3;
}

.editor-button:active {
  transform: scale(.97);
}

.editor-button:disabled {
  cursor: wait;
  opacity: .55;
}

.editor-button:focus-visible,
.editor-close:focus-visible {
  outline: 2px solid #d82139;
  outline-offset: 4px;
}

.editor-cover-image[hidden],
.editor-cover-placeholder[hidden] {
  display: none;
}

@keyframes editor-arrive {
  from { opacity: 0; transform: translateY(12px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 560px) {
  #program-editor.editor-dialog {
    width: calc(100vw - 20px);
    height: calc(100dvh - 32px);
    max-height: calc(100dvh - 20px);
    border-radius: 22px;
  }
  .editor-header {
    padding: 23px 22px 20px;
  }
  .editor-title {
    font-size: 23px;
  }
  .editor-form {
    padding: 2px 22px 25px;
    gap: 19px;
  }
  .editor-input,
  .editor-select {
    font-size: 16px;
  }
  .editor-cover {
    grid-template-columns: 66px minmax(0, 1fr);
    gap: 12px;
  }
  .editor-cover-preview {
    width: 66px;
    height: 94px;
  }
  .editor-footer {
    padding: 12px 22px 21px;
  }
  .editor-button {
    padding-inline: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #program-editor.editor-dialog[open] {
    animation: none;
  }
  .editor-button,
  .editor-close {
    transition: none;
  }
}

.editor-note {
  margin: -4px 0 2px;
  color: #9898a0;
  font-size: 11px;
  line-height: 1.5;
}
