#open-study { margin-top: 12px; }
.study-icon { border-color: #756297; background: #3a2e56; color: #e1cfff; font-size: 23px; }
#study-screen { max-width: 650px; margin: 0 auto; }
.study-header { align-items: center; margin-bottom: 15px; }
#study-title { font-size: clamp(33px, 9vw, 47px); }
#study-title:focus { outline: none; }
.study-primary, .study-quiet {
  min-height: 40px;
  padding: 7px 12px;
  border: 1px solid #6c5384;
  border-radius: 12px;
  background: #2b213b;
  color: #f4e8fb;
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}
.study-primary { background: #dbbef4; border-color: #e3cbf9; color: #281b37; }
.study-primary:disabled, .study-quiet:disabled { opacity: .55; cursor: default; }
.study-quiet[aria-pressed="true"] { border-color: #a780cb; color: #f6defd; background: #49355d; }
.study-danger { color: #ffc2d1; border-color: #87546b; }
.study-search {
  display: flex;
  gap: 7px;
  min-width: 0;
  padding: 6px;
  border: 1px solid #604974;
  border-radius: 16px;
  background: #21192f;
}
.study-search input, .study-search select, .study-dialog input, .study-dialog select, .study-dialog textarea {
  min-width: 0;
  border: 1px solid #675175;
  border-radius: 10px;
  background: #191325;
  color: #f9edf9;
  font: inherit;
  font-size: 16px;
}
.study-search input { flex: 1; padding: 9px; border-color: transparent; background: transparent; }
.study-search select { flex: 0 0 auto; max-width: 43%; padding: 3px 5px; font-size: 12px; }
.study-search input::placeholder, .study-dialog textarea::placeholder { color: #b7a3c9; }
.study-toolbar, .study-actions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 11px;
}
.study-path { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-top: 16px; }
.study-path button {
  padding: 3px 4px;
  border: 0;
  background: transparent;
  color: #d5bae8;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  overflow-wrap: anywhere;
}
.study-path span { color: #ab8dbb; font-size: 12px; overflow-wrap: anywhere; }
.study-topic-tools { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 8px; }
.study-topic-tools h2 { overflow-wrap: anywhere; font-size: 19px; }
.study-menu { position: relative; display: flex; }
.study-menu summary {
  display: grid;
  place-items: center;
  width: 38px;
  min-height: 34px;
  border: 1px solid #665078;
  border-radius: 10px;
  color: #e6cff5;
  background: #2b213b;
  list-style: none;
  cursor: pointer;
}
.study-menu summary::-webkit-details-marker { display: none; }
.study-menu-actions {
  position: absolute;
  z-index: 2;
  right: 0;
  top: calc(100% + 4px);
  display: grid;
  width: max-content;
  min-width: 145px;
  padding: 4px;
  border: 1px solid #795a88;
  border-radius: 12px;
  background: #30223e;
  box-shadow: 0 9px 24px #110a19a8;
}
.study-menu button {
  min-height: 37px;
  padding: 6px 9px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #f5e7fd;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.study-menu button:hover { background: #443151; }
.study-menu button.study-danger { color: #ffc2d1; }
#study-status:not(:empty) { margin: 15px 2px 0; }
.study-group { margin-top: 18px; }
.study-group > h2 { margin-bottom: 8px; font-size: 15px; color: #e6d4f2; }
.study-notes-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.study-notes-heading h2 { margin: 0; font-size: 15px; color: #e6d4f2; }
.study-order-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; align-items: center; }
.study-order-controls { display: grid; gap: 4px; }
.study-order-controls button { min-width: 44px; min-height: 44px; padding: 4px; font-size: 18px; }
.study-order-controls button:disabled { opacity: .36; }
.study-drag-handle {
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  cursor: grab;
  position: relative;
}
.study-list-button:has(.study-drag-handle) {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.study-drag-handle::before {
  content: "";
  width: 12px;
  height: 18px;
  background: radial-gradient(circle, currentColor 1.25px, transparent 1.7px) 0 0 / 6px 6px;
  pointer-events: none;
}
.study-drag-handle::after { content: ""; position: absolute; inset: -5px; }
.study-dragging > .study-list-button { opacity: .5; }
.study-drop-before { box-shadow: 0 -3px #dcb4f6; }
.study-drop-after { box-shadow: 0 3px #dcb4f6; }
.study-group ul { display: grid; gap: 7px; list-style: none; margin: 0; padding: 0; }
.study-list-button {
  display: grid;
  width: 100%;
  grid-template-columns: 35px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  padding: 10px;
  border: 1px solid #523e60;
  border-radius: 14px;
  background: linear-gradient(115deg, #2c223b, #211a2e);
  color: inherit;
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.study-list-button:hover { border-color: #896c9d; }
.study-list-icon {
  display: grid;
  place-items: center;
  width: 35px;
  height: 35px;
  border: 1px solid #675386;
  border-radius: 10px;
  background: #3a2c54;
  color: #e2cbfa;
  font-size: 17px;
}
.study-list-button[data-kind="template"] .study-list-icon { background: #3f2a49; color: #f2b8e5; }
.study-list-button[data-kind="example"] .study-list-icon { background: #263747; color: #b0e1ed; }
.study-list-text { display: grid; gap: 4px; min-width: 0; overflow-wrap: anywhere; }
.study-list-text strong { line-height: 1.25; }
.study-list-text small { color: #c5b3d2; line-height: 1.3; }
.study-list-arrow { color: #cdb4df; font-size: 18px; }
.study-dialog { width: min(540px, calc(100% - 26px)); max-width: none; max-height: calc(100dvh - 24px); }
.study-dialog h2 { overflow-wrap: anywhere; }
.study-add-location {
  margin: 6px 0 14px;
  color: #c7b2db;
  overflow-wrap: anywhere;
}
.study-add-options { display: grid; gap: 9px; }
.study-add-option {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #604975;
  border-radius: 14px;
  background: #251b33;
  color: #f7eefc;
  text-align: left;
  cursor: pointer;
}
.study-add-option span { color: #ccb8dd; font-size: 13px; line-height: 1.4; }
.study-add-option:not(:disabled):hover { background: #38274a; }
.study-add-option:focus-visible { outline: 2px solid #e0bafa; outline-offset: 2px; }
.study-add-option:disabled { opacity: .65; cursor: default; }
.study-dialog label { display: block; margin: 10px 0 5px; color: #e9daf3; font-size: 13px; }
.study-dialog input, .study-dialog select, .study-dialog textarea { width: 100%; padding: 8px 9px; }
.study-dialog textarea { resize: vertical; }
.study-dialog select { text-overflow: ellipsis; }
.study-form-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 8px; }
.study-reader { padding: 15px; }
.study-reader-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.study-reader-header > div { min-width: 0; }
.study-reader-header p { margin: 0 0 5px; overflow-wrap: anywhere; }
.study-reader-actions { margin-bottom: 12px; }
.study-prose {
  padding: 13px;
  border: 1px solid #523d61;
  border-radius: 12px;
  background: #1d1628;
  color: #f0e1f6;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.study-prose h3, .study-prose h4 { margin: 12px 0 6px; }
.study-prose > :first-child { margin-top: 0; }
.study-prose p { color: inherit; white-space: pre-wrap; }
.study-prose ul, .study-prose ol { padding-left: 21px; margin: 7px 0; }
.study-prose pre { margin: 8px 0; padding: 8px; border-radius: 8px; background: #120e1c; white-space: pre-wrap; }
.study-prose code { color: #edd1f4; }
#study-view-feedback:empty, #study-edit-feedback:empty, #study-topic-feedback:empty,
#study-transfer-feedback:empty { display: none; }
.study-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
