:root {
  --jse-toolbar-height: 58px;
}

body.jse-editor-present {
  padding-top: var(--jse-toolbar-height);
}

.jse-editor-present .topbar {
  top: var(--jse-toolbar-height);
}

.jse-editor-present .change-strategist-button {
  top: calc(
    var(--jse-toolbar-height) + 78px + max(0px, env(safe-area-inset-top) - 12px)
  );
}

.jse-toolbar {
  position: fixed;
  z-index: 10020;
  top: 0;
  right: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--jse-toolbar-height);
  padding: 8px 14px;
  color: #fff9f6;
  background: rgba(23, 19, 20, 0.96);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 8px 24px rgba(23, 19, 20, 0.2);
  backdrop-filter: blur(16px);
}

.jse-toolbar-inner {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  width: min(100%, 720px);
}

.jse-toolbar-title {
  display: flex;
  gap: 9px;
  align-items: center;
  min-width: 0;
}

.jse-toolbar-mark {
  display: grid;
  flex: 0 0 32px;
  place-items: center;
  width: 32px;
  height: 32px;
  color: #171314;
  font-weight: 900;
  background: #e8b7bb;
  border-radius: 10px 10px 10px 3px;
}

.jse-toolbar-title strong,
.jse-toolbar-title small {
  display: block;
}

.jse-toolbar-title strong {
  font-size: 12px;
}

.jse-toolbar-title small {
  overflow: hidden;
  color: rgba(255, 255, 255, 0.58);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.jse-toolbar-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.jse-toolbar button {
  min-width: 38px;
  min-height: 34px;
  padding: 0 10px;
  color: #fff9f6;
  font-size: 11px;
  font-weight: 750;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 10px;
  cursor: pointer;
}

.jse-toolbar button:hover:not(:disabled) {
  color: #171314;
  background: #f3d8d7;
}

.jse-toolbar button:disabled {
  opacity: 0.32;
  cursor: not-allowed;
}

.jse-toolbar button.jse-edit-toggle.is-active {
  color: #171314;
  background: #e8b7bb;
  border-color: #e8b7bb;
}

.jse-save-state {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  color: rgba(255, 255, 255, 0.62);
  font-size: 9px;
  white-space: nowrap;
}

.jse-save-state::before {
  width: 6px;
  height: 6px;
  content: "";
  background: #79a98c;
  border-radius: 50%;
}

.jse-save-state[data-status="saving"]::before {
  background: #e8b7bb;
  animation: jse-pulse 900ms ease infinite alternate;
}

.jse-save-state[data-status="fallback"]::before,
.jse-save-state[data-status="error"]::before {
  background: #e4a34d;
}

.jse-editable {
  position: relative;
  outline: 1px dashed rgba(183, 95, 112, 0.7) !important;
  outline-offset: 3px;
  border-radius: 3px;
  transition:
    outline-color 120ms ease,
    background-color 120ms ease;
}

.jse-editable:hover,
.jse-editable:focus {
  background: rgba(243, 216, 215, 0.44) !important;
  outline: 2px solid #b75f70 !important;
  outline-offset: 4px;
}

.jse-editable[data-editor-mode="dialog"]::after {
  position: absolute;
  top: -9px;
  right: -7px;
  padding: 2px 6px;
  color: white;
  font-size: 8px;
  line-height: 1.3;
  content: "点按编辑";
  background: #b75f70;
  border-radius: 999px;
}

.jse-image-editable {
  outline: 2px dashed #b75f70 !important;
  outline-offset: 4px;
}

.jse-dialog-backdrop {
  position: fixed;
  z-index: 10030;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(23, 19, 20, 0.58);
  backdrop-filter: blur(10px);
}

.jse-dialog {
  width: min(100%, 500px);
  padding: 24px;
  color: #171314;
  background: #fff9f6;
  border-radius: 24px;
  box-shadow: 0 28px 80px rgba(23, 19, 20, 0.35);
}

.jse-dialog h2 {
  margin: 0 0 8px;
  font-size: 20px;
}

.jse-dialog p {
  margin: 0 0 14px;
  color: #6a5d5f;
  font-size: 11px;
}

.jse-dialog textarea {
  width: 100%;
  min-height: 150px;
  padding: 14px;
  color: #171314;
  line-height: 1.65;
  background: white;
  border: 1px solid rgba(23, 19, 20, 0.16);
  border-radius: 14px;
  outline: none;
  resize: vertical;
}

.jse-dialog textarea:focus {
  border-color: #b75f70;
  box-shadow: 0 0 0 3px rgba(183, 95, 112, 0.12);
}

.jse-dialog-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 14px;
}

.jse-check-list {
  display: grid;
  gap: 8px;
  padding: 0;
  margin: 15px 0 0;
  list-style: none;
}

.jse-check-list li {
  display: grid;
  grid-template-columns: 26px 1fr auto;
  gap: 9px;
  align-items: center;
  min-height: 46px;
  padding: 8px 10px;
  background: rgba(23, 19, 20, 0.045);
  border-radius: 12px;
}

.jse-check-list li > span {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  color: white;
  background: #79a98c;
  border-radius: 50%;
}

.jse-check-list li.failed > span {
  background: #b75f70;
}

.jse-check-list strong {
  font-size: 12px;
}

.jse-check-list small {
  color: #75686a;
  font-size: 9px;
}

.jse-dialog-actions button {
  min-height: 42px;
  padding: 0 16px;
  font-weight: 750;
  border-radius: 12px;
  cursor: pointer;
}

.jse-dialog-cancel {
  color: #514849;
  background: transparent;
  border: 1px solid rgba(23, 19, 20, 0.14);
}

.jse-dialog-save {
  color: #fff9f6;
  background: #171314;
  border: 1px solid #171314;
}

@keyframes jse-pulse {
  to {
    transform: scale(1.5);
    opacity: 0.52;
  }
}

@media (min-width: 700px) {
  body.jse-editor-present {
    padding-top: calc(var(--jse-toolbar-height) + 22px);
  }
}

@media (max-width: 560px) {
  .jse-toolbar-title small,
  .jse-save-state span {
    display: none;
  }

  .jse-toolbar {
    padding-inline: 8px;
  }

  .jse-toolbar button {
    padding-inline: 8px;
  }
}
