html.markdown-page,
html.markdown-page body {
  min-height: 100%;
  min-height: 100dvh;
}

html.markdown-page body {
  overflow-x: clip;
}

html.markdown-page #field,
html.markdown-page .spot,
html.markdown-page .noise {
  display: none;
}

html.markdown-page body.markdown-native-cursor {
  cursor: auto;
}

html.markdown-page body.markdown-native-cursor .cursor,
html.markdown-page body.markdown-native-cursor .click-burst {
  visibility: hidden;
}

.markdown-page .floor {
  margin-top: 8px;
}

.markdown-intro {
  position: relative;
  z-index: 3;
  width: min(1280px, calc(100% - 48px));
  margin: 0 auto 18px;
}

.markdown-intro h1 {
  font-family: "Clash Display", "Satoshi", "Segoe UI", system-ui, sans-serif;
  font-size: clamp(28px, 4vw, 42px);
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

.markdown-intro .meta {
  color: var(--mute);
  font-size: 14px;
}

.markdown-shell {
  position: relative;
  z-index: 3;
  width: min(1280px, calc(100% - 48px));
  margin: 0 auto 48px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 1fr);
  gap: 18px;
  align-items: stretch;
  min-height: min(72vh, 760px);
}

.editor-panel,
.preview-panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  background: #0c0c12;
  cursor: auto;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--line);
}

.panel-kicker {
  font-family: "Clash Display", "Satoshi", "Segoe UI", system-ui, sans-serif;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--mute);
}

.panel-actions,
.fmt-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.fmt-bar {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.fmt-btn,
.panel-actions button,
.lang-chip {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(244, 241, 234, 0.04);
  color: var(--ink);
  font: 600 12px/1 "Satoshi", "Segoe UI", system-ui, -apple-system, sans-serif;
  letter-spacing: 0.04em;
  min-height: 32px;
  padding: 0 10px;
  cursor: pointer;
}

.fmt-btn:hover,
.panel-actions button:hover,
.lang-chip:hover {
  border-color: rgba(214, 255, 75, 0.45);
  color: var(--acid);
}

.fmt-btn[aria-pressed="true"] {
  border-color: var(--acid);
}

#editor {
  flex: 1;
  width: 100%;
  min-height: 360px;
  resize: none;
  border: 0;
  padding: 16px;
  background: transparent;
  color: var(--ink);
  font: 15px/1.55 ui-monospace, "Source Code Pro", Menlo, Consolas, monospace;
  outline: none;
  cursor: text;
}

#editor::placeholder {
  color: var(--mute);
}

.editor-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 16px 14px;
  border-top: 1px solid var(--line);
  color: var(--mute);
  font-size: 12px;
}

#count.over {
  color: #ff6b6b;
}

.lang-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 12px 12px;
}

.lang-chip {
  min-height: 26px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: lowercase;
}

.discord-app {
  flex: 1;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  min-height: 520px;
  background: #313338;
  color: #dbdee1;
  font-family: "gg sans", "Noto Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

.discord-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 0;
  background: #1e1f22;
}

.discord-guild {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: #5865f2;
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.discord-chat {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: #313338;
}

.discord-titlebar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 16px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.3);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.12);
  font-weight: 600;
  color: #f2f3f5;
}

.discord-hash {
  color: #80848e;
  font-size: 22px;
  font-weight: 500;
}

.discord-messages {
  flex: 1;
  overflow: auto;
  padding: 16px 8px 24px 0;
}

.discord-msg {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  padding: 4px 16px 4px 0;
}

.discord-avatar {
  width: 40px;
  height: 40px;
  margin-left: 16px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #d6ff4b;
  color: #111;
  font-weight: 800;
}

.discord-body {
  min-width: 0;
  padding-top: 2px;
}

.discord-meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 2px;
}

.discord-name {
  font-weight: 600;
  color: #d6ff4b;
}

.discord-time {
  color: #949ba4;
  font-size: 12px;
}

#preview {
  font-size: 16px;
  line-height: 1.375;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  cursor: text;
}

.dmd-empty {
  color: #949ba4;
}

.dmd-p {
  display: block;
  margin: 0;
}

.dmd-h {
  margin: 8px 0 4px;
  font-weight: 700;
  line-height: 1.25;
  color: #f2f3f5;
}

.dmd-h1 { font-size: 1.5em; }
.dmd-h2 { font-size: 1.25em; }
.dmd-h3 { font-size: 1.125em; }

.dmd-sub {
  display: block;
  font-size: 0.8125em;
  color: #949ba4;
  margin: 2px 0 4px;
}

.dmd-quote {
  margin: 4px 0;
  padding: 0 0 0 12px;
  border-left: 4px solid #4e5058;
  color: #c4c9ce;
}

.dmd-inline-code,
.dmd-codeblock {
  font-family: "gg mono", "Source Code Pro", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.dmd-inline-code {
  font-size: 0.85em;
  background: #1e1f22;
  padding: 0.15em 0.35em;
  border-radius: 4px;
  color: #dbdee1;
}

.dmd-codeblock {
  position: relative;
  margin: 6px 0 8px;
  padding: 8px 12px;
  background: #1e1f22;
  border-radius: 4px;
  overflow-x: auto;
  white-space: pre;
  font-size: 0.875em;
  line-height: 1.375;
  color: #dbdee1;
}

.dmd-codeblock code {
  font: inherit;
}

.dmd-code-lang {
  display: block;
  margin-bottom: 6px;
  color: #949ba4;
  font-size: 11px;
  text-transform: lowercase;
  font-family: "gg sans", "Noto Sans", sans-serif;
}

.dmd-list {
  margin: 4px 0;
  padding: 0;
  list-style: none;
}

.dmd-list li {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.dmd-list-marker {
  flex: 0 0 auto;
  color: #949ba4;
  min-width: 1.1em;
}

.dmd-spoiler {
  display: inline;
  background: #1e1f22;
  color: transparent;
  border-radius: 4px;
  cursor: pointer;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.dmd-spoiler-inner {
  opacity: 0;
  pointer-events: none;
  user-select: none;
}

.dmd-spoiler.open {
  background: rgba(255, 255, 255, 0.08);
  color: inherit;
  cursor: text;
}

.dmd-spoiler.open .dmd-spoiler-inner {
  opacity: 1;
}

.dmd-link {
  color: #00a8fc;
  text-decoration: none;
  cursor: pointer;
}

.dmd-link:hover {
  text-decoration: underline;
}

.dmd-mention {
  background: rgba(88, 101, 242, 0.3);
  color: #c9cdfb;
  border-radius: 3px;
  padding: 0 2px;
  font-weight: 500;
}

.dmd-time {
  background: rgba(0, 0, 0, 0.18);
  border-radius: 3px;
  padding: 0 3px;
  font-variant-numeric: tabular-nums;
}

.dmd-emoji.jumbo {
  font-size: 3rem;
  line-height: 1;
}

.hljs-comment,
.hljs-quote { color: #8b929a; }
.hljs-keyword,
.hljs-selector-tag,
.hljs-literal { color: #c9a7ff; }
.hljs-string,
.hljs-addition { color: #b8db81; }
.hljs-number,
.hljs-attr { color: #e5a36c; }
.hljs-title,
.hljs-section,
.hljs-name { color: #6cb6ff; }
.hljs-built_in,
.hljs-type { color: #e3c36e; }
.hljs-deletion { color: #f47b67; }
.hljs-meta { color: #8ec7ff; }

.cheat {
  position: relative;
  z-index: 3;
  width: min(1280px, calc(100% - 48px));
  margin: 0 auto 64px;
  border: 1px solid var(--line);
  background: rgba(7, 7, 11, 0.42);
  padding: 20px 22px;
}

.cheat h2 {
  font-family: "Clash Display", "Satoshi", "Segoe UI", system-ui, sans-serif;
  font-size: 18px;
  margin-bottom: 12px;
}

.cheat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px 24px;
}

.cheat dt {
  color: var(--mute);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.cheat dd {
  font-family: ui-monospace, "Source Code Pro", Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink);
}

.cheat code {
  color: var(--acid);
}

@media (max-width: 980px) {
  .markdown-shell {
    grid-template-columns: 1fr;
    width: calc(100% - 28px);
    min-height: 0;
  }

  .markdown-intro,
  .cheat {
    width: calc(100% - 28px);
  }

  #editor,
  .discord-app {
    min-height: 420px;
  }
}

@media (max-width: 720px) {
  .discord-app {
    grid-template-columns: 1fr;
  }

  .discord-rail {
    display: none;
  }

  .fmt-bar {
    overflow-x: auto;
    flex-wrap: nowrap;
  }
}
