html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  background: #e6e6e6;
  color: #111;
  font-family: "宋体", SimSun, serif;
  font-size: 12px;
  --page-width-ratio: 100%;
}

button,
select,
textarea,
input {
  font-family: inherit;
  font-size: 12px;
}

.app-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100%;
  width: 100%;
  min-height: 0;
  min-width: 0;
}

.toolbar-row {
  display: flex;
  align-items: center;
  gap: 2px;
  min-height: 28px;
  padding: 1px 4px;
  overflow: hidden;
  background: buttonface;
  border-top: 1px solid buttonhighlight;
  border-left: 1px solid buttonhighlight;
  border-right: 1px solid buttonshadow;
  border-bottom: 1px solid buttonshadow;
  box-sizing: border-box;
  white-space: nowrap;
}

.toolbar-select {
  height: 22px;
  min-width: 118px;
  background: buttonface;
}

.toolbar-select-small {
  min-width: 64px;
}

.sep {
  width: 1px;
  height: 22px;
  margin: 0 3px;
  border-left: 1px solid buttonshadow;
  border-right: 1px solid buttonhighlight;
}

.toolbar-spacer {
  flex: 1 1 auto;
  min-width: 12px;
}

.icon-btn,
.color-tool {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid buttonface;
  background: buttonface;
  box-sizing: border-box;
  cursor: default;
}

.icon-btn:hover,
.color-tool:hover {
  border-top-color: buttonhighlight;
  border-left-color: buttonhighlight;
  border-right-color: buttonshadow;
  border-bottom-color: buttonshadow;
}

.icon-btn:active,
.color-tool:active {
  border-top-color: buttonshadow;
  border-left-color: buttonshadow;
  border-right-color: buttonhighlight;
  border-bottom-color: buttonhighlight;
}

.icon-btn img {
  max-width: 22px;
  max-height: 22px;
  pointer-events: none;
}

.color-tool img {
  max-width: 18px;
  max-height: 18px;
  pointer-events: none;
}

.color-tool input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.width-presets {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
}

.width-preset-btn {
  min-width: 44px;
  height: 22px;
  padding: 0 6px;
  border: 1px solid buttonface;
  background: buttonface;
  color: #b40000;
  box-sizing: border-box;
  cursor: default;
}

.width-preset-btn:hover {
  border-top-color: buttonhighlight;
  border-left-color: buttonhighlight;
  border-right-color: buttonshadow;
  border-bottom-color: buttonshadow;
}

.width-preset-btn:active,
.width-preset-btn.active {
  border-top-color: buttonshadow;
  border-left-color: buttonshadow;
  border-right-color: buttonhighlight;
  border-bottom-color: buttonhighlight;
  background: #f3f3f3;
}

.workspace {
  min-height: 0;
  min-width: 0;
  background: #fff;
  border-left: 1px solid #b8b8b8;
  border-right: 1px solid #b8b8b8;
}

.editor-surface,
.html-surface,
.preview-surface {
  min-width: 0;
  width: min(100%, var(--page-width-ratio));
  max-width: var(--page-width-ratio);
  height: 100%;
  margin: 0 auto;
  padding: 6px;
  border: 0;
  outline: 0;
  overflow: auto;
  overflow-x: hidden;
  background: #fff;
  box-sizing: border-box;
  font-size: 14px;
  line-height: 1.55;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.editor-surface img,
.preview-surface img {
  max-width: 100%;
  height: auto;
}

.editor-surface b,
.editor-surface strong,
.preview-surface b,
.preview-surface strong {
  font-weight: 900;
  color: #000;
}

.html-surface,
.preview-surface {
  display: none;
}

.html-surface {
  resize: none;
  white-space: pre-wrap;
  font-family: Consolas, "Courier New", monospace;
}

.bottom-bar {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 4px 8px;
  min-width: 0;
  overflow: visible;
  background: #e6e6e6;
  border-top: 1px solid #d0d0d0;
  box-sizing: border-box;
}

.bottom-top-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
}

.mode-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  align-self: start;
  flex: 0 0 auto;
  min-width: 0;
}

.mode-tab {
  min-width: 42px;
  height: 20px;
  padding: 0 7px;
  border: 1px solid #777;
  border-bottom-color: #333;
  background: #f8f8f8;
  cursor: default;
}

.mode-tab + .mode-tab {
  margin-left: -1px;
}

.mode-tab.active {
  font-weight: bold;
  background: #fff;
}

.word-count {
  align-self: center;
  margin-left: 4px;
  white-space: nowrap;
  color: #333;
}

.mode-tab-action {
  font-weight: normal;
  background: #f8f8f8;
}

.options {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 2px 8px;
  line-height: 18px;
  flex: 1 1 auto;
  align-content: flex-start;
  min-width: 0;
}

.options label {
  white-space: nowrap;
}

.options input {
  vertical-align: -2px;
}

.submit-links {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 4px 12px;
  min-width: 0;
}

.submit-link {
  line-height: 20px;
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
}

.submit-link-muted {
  color: #555;
}

.submit-link:hover {
  text-decoration: underline;
}

.commands {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
  white-space: normal;
  width: 100%;
  min-width: 0;
}

.commands button {
  height: 26px;
  padding: 1px 9px;
  border: 1px solid #888;
  background: #f4f4f4;
  flex: 0 0 auto;
}

.commands button:active {
  background: #ddd;
}

@media (max-width: 900px) {
  .toolbar-row {
    overflow-x: auto;
  }

  .bottom-top-row {
    flex-direction: column;
    gap: 4px;
  }

  .submit-links {
    margin-left: 0;
  }
}

@media (max-width: 1320px) {
  .bottom-top-row {
    flex-wrap: wrap;
  }
}
