.rich-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 7px;
  border: 1px solid #60486e;
  border-radius: 12px 12px 0 0;
  background: #30223d;
}

.rich-toolbar button, .rich-toolbar select {
  min-height: 36px;
  padding: 5px 8px;
  border: 1px solid #674d77;
  border-radius: 8px;
  background: #241a30;
  color: #f5e7fa;
  font: inherit;
  font-size: 13px;
}

.rich-toolbar button { cursor: pointer; }
.rich-toolbar button[aria-pressed="true"] { background: #694e86; border-color: #a77fbc; }
.study-dialog .rich-toolbar select { width: auto; max-width: 100%; }
.rich-editor {
  min-height: 175px;
  max-height: 42dvh;
  overflow-y: auto;
  border-top: 0;
  border-radius: 0 0 12px 12px;
  font-size: 16px;
  white-space: pre-wrap;
  caret-color: #ebc8ff;
}
.rich-editor:focus { outline: 2px solid #a57dc3; outline-offset: -2px; }
.rich-editor:empty::before { content: attr(data-placeholder); color: #b7a3c9; pointer-events: none; }
.study-prose h1, .study-prose h2 { margin: 12px 0 7px; font-size: 24px; line-height: 1.23; }
.study-prose h3 { font-size: 19px; line-height: 1.3; }
.study-prose blockquote { margin: 10px 0; padding: 3px 10px; border-left: 3px solid #a679c3; color: #dec7eb; }
.study-prose a, .attachment-links a { color: #e7c2ff; text-decoration: underline; text-underline-offset: 3px; }
.rich-link-panel { display: flex; gap: 6px; padding: 8px 0; }
.rich-link-panel input { flex: 1; min-width: 0; }

.attachment-editor { position: relative; margin-top: 13px; }
.attachment-editor input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
.attachment-editor .attachment-add {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  margin: 0 0 7px;
  padding: 7px 11px;
  border: 1px solid #745987;
  border-radius: 11px;
  background: #372747;
  color: #f5e3ff;
  cursor: pointer;
}
.attachment-editor:has(input[type="file"]:focus-visible) .attachment-add { outline: 2px solid #e7c2ff; }
.attachment-editor:has(input[type="file"]:disabled) .attachment-add { opacity: .55; cursor: default; }
.attachment-editor label span { color: #cdb7d9; font-size: 12px; }
.attachment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(66px, 1fr));
  gap: 6px;
  margin: 8px 0;
}
.attachment-grid:empty { display: none; }
.attachment-tile {
  position: relative;
  display: block;
  min-width: 0;
  aspect-ratio: 1;
  padding: 0;
  border: 1px solid #634d74;
  border-radius: 10px;
  background: #211729;
  overflow: hidden;
}
button.attachment-tile { cursor: zoom-in; }
.attachment-tile img { display: block; width: 100%; height: 100%; object-fit: cover; color: #d5c3df; font-size: 11px; }
.attachment-tile > button {
  position: absolute;
  inset: 2px 2px auto auto;
  width: 30px;
  height: 30px;
  border: 1px solid #846898;
  border-radius: 8px;
  background: #21142de8;
  color: #fff;
  font-size: 19px;
  cursor: pointer;
}
.attachment-links { display: grid; gap: 4px; overflow-wrap: anywhere; }
#study-attachment-feedback:empty, #wish-attachment-feedback:empty, #study-view-text:empty { display: none; }
.attachment-viewer > button { display: block; margin: 0 0 9px auto; min-width: 40px; }
.attachment-viewer img { display: block; max-width: 100%; max-height: 75dvh; margin: auto; object-fit: contain; }
.wish-menu-actions {
  position: absolute;
  z-index: 1;
  inset: calc(100% + 5px) 0 auto auto;
  display: grid;
  gap: 4px;
}
.wish-menu .wish-menu-actions button { position: static; }
.wish-menu .wish-menu-actions button:first-child { color: #f3ddfb; }
