.character-notes {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(250px, 330px);
  gap: 22px;
  width: min(1120px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 24px;
  box-sizing: border-box;

  color: #2d2119;
  background: linear-gradient(145deg, #fffaf2, #eee3d2);
  border: 1px solid #c9bdac;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.vampire-sheet-app .character-notes {
  color: #ede6df;
  background:
    linear-gradient(
      145deg,
      rgba(34, 24, 24, 0.98),
      rgba(18, 14, 16, 0.98)
    );
  border-color: rgba(179, 144, 96, 0.38);
  box-shadow:
    0 22px 48px rgba(0, 0, 0, 0.44),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.character-notes-document,
.character-notes-reference {
  min-width: 0;
}

.character-notes-topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.character-notes-nav-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.character-notes-back,
.character-notes-new,
.character-notes-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 14px;

  color: #3a2720;
  background: rgba(255, 250, 242, 0.76);
  border: 1px solid #c4ae91;
  border-radius: 999px;

  font-weight: 850;
}

.character-notes-new span {
  font-size: 1.15rem;
  line-height: 1;
}

.character-notes-back:hover,
.character-notes-new:hover {
  background: #f4dfbd;
}

.character-notes-delete {
  color: #7a1f1f;
  border-color: rgba(122, 31, 31, 0.34);
}

.character-notes-delete:hover {
  background: rgba(122, 31, 31, 0.08);
}

.vampire-sheet-app .character-notes-back,
.vampire-sheet-app .character-notes-new,
.vampire-sheet-app .character-notes-delete {
  color: #f0d7b0;
  background: rgba(20, 14, 16, 0.74);
  border-color: rgba(179, 144, 96, 0.44);
}

.vampire-sheet-app .character-notes-back:hover,
.vampire-sheet-app .character-notes-new:hover {
  background: rgba(65, 31, 33, 0.84);
}

.vampire-sheet-app .character-notes-delete {
  color: #e8a1a1;
  border-color: rgba(142, 53, 61, 0.56);
}

.vampire-sheet-app .character-notes-delete:hover {
  background: rgba(90, 28, 34, 0.62);
}

.character-notes-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: min(100%, 320px);
}

.character-notes-selector span {
  color: #6c5a49;
  font-size: 0.84rem;
  font-weight: 750;
  white-space: nowrap;
}

.vampire-sheet-app .character-notes-selector span {
  color: #bfaea3;
}

.character-notes-selector select {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  padding: 0 10px;

  color: #241716;
  background: #fffdf9;
  border: 1px solid #c4ae91;
  border-radius: 6px;
}

.vampire-sheet-app .character-notes-selector select {
  color: #f0d7b0;
  background: rgba(20, 14, 16, 0.74);
  border-color: rgba(179, 144, 96, 0.44);
}

.character-notes-document {
  display: grid;
  gap: 14px;
}

.character-notes-kicker,
.character-notes-facts dt {
  color: #7a1f1f;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.vampire-sheet-app .character-notes-kicker,
.vampire-sheet-app .character-notes-facts dt {
  color: #c19a62;
}

.character-notes-title-input {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 0 14px;
  box-sizing: border-box;

  color: #241716;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid #c9bdac;
  border-radius: 7px;

  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.45rem;
  font-weight: 800;
}

.vampire-sheet-app .character-notes-title-input {
  color: #f0d7b0;
  background: rgba(255, 255, 255, 0.055);
  border-color: rgba(179, 144, 96, 0.34);
}

.character-notes-rich-editor {
  display: grid;
  gap: 0;
}

.character-notes-formatbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 8px;

  background: rgba(255, 255, 255, 0.54);
  border: 1px solid #d6c9b6;
  border-bottom: 0;
  border-radius: 7px 7px 0 0;
}

.vampire-sheet-app .character-notes-formatbar {
  background: rgba(255, 255, 255, 0.045);
  border-color: rgba(179, 144, 96, 0.3);
}

.character-notes-formatbar select,
.character-notes-formatbar button {
  min-height: 32px;
  padding: 0 9px;

  color: #3a2720;
  background: rgba(255, 250, 242, 0.86);
  border: 1px solid #c4ae91;
  border-radius: 6px;

  font: inherit;
  font-size: 0.82rem;
  font-weight: 850;
}

.character-notes-formatbar button {
  min-width: 34px;
}

.character-notes-formatbar button:hover,
.character-notes-formatbar select:hover {
  background: #f4dfbd;
}

.vampire-sheet-app .character-notes-formatbar select,
.vampire-sheet-app .character-notes-formatbar button {
  color: #f0d7b0;
  background: rgba(20, 14, 16, 0.74);
  border-color: rgba(179, 144, 96, 0.44);
}

.vampire-sheet-app .character-notes-formatbar button:hover,
.vampire-sheet-app .character-notes-formatbar select:hover {
  background: rgba(65, 31, 33, 0.84);
}

.character-notes-editor,
.character-notes-preview {
  width: 100%;
  min-height: 62vh;
  padding: 26px;
  box-sizing: border-box;

  color: #241716;
  background: linear-gradient(#fffdf8, #fffaf1);
  border: 1px solid #d6c9b6;
  border-radius: 7px;

  font: 1rem/1.7 Georgia, "Times New Roman", serif;
  white-space: pre-wrap;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.65),
    0 12px 24px rgba(43, 28, 14, 0.1);
}

.character-notes-editor {
  overflow-y: auto;
  border-radius: 0 0 7px 7px;
  outline: none;
}

.character-notes-editor:focus {
  border-color: #b08a4c;
}

.character-notes-editor:empty::before {
  content: attr(data-placeholder);
  color: #8c7b68;
  pointer-events: none;
}

.vampire-sheet-app .character-notes-editor,
.vampire-sheet-app .character-notes-preview {
  color: #f3e7cf;
  background: rgba(9, 8, 9, 0.72);
  border-color: rgba(179, 144, 96, 0.3);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.035),
    0 18px 34px rgba(0, 0, 0, 0.28);
}

.vampire-sheet-app .character-notes-editor:empty::before {
  color: #927f73;
}

.character-notes-editor h2,
.character-notes-preview h2 {
  margin: 0 0 12px;
  font-size: 1.55rem;
  line-height: 1.2;
}

.character-notes-editor h3,
.character-notes-preview h3 {
  margin: 18px 0 8px;
  font-size: 1.18rem;
  line-height: 1.25;
}

.character-notes-editor p,
.character-notes-preview p,
.character-notes-editor div,
.character-notes-preview div {
  margin: 0 0 12px;
}

.character-notes-editor ul,
.character-notes-editor ol,
.character-notes-preview ul,
.character-notes-preview ol {
  margin: 0 0 14px;
  padding-left: 24px;
}

.character-notes-editor blockquote,
.character-notes-preview blockquote {
  margin: 0 0 14px;
  padding: 10px 14px;

  color: #5b4839;
  background: rgba(122, 31, 31, 0.06);
  border-left: 4px solid rgba(122, 31, 31, 0.28);
}

.vampire-sheet-app .character-notes-editor blockquote,
.vampire-sheet-app .character-notes-preview blockquote {
  color: #dfc8b8;
  background: rgba(121, 11, 28, 0.16);
  border-left-color: rgba(179, 144, 96, 0.42);
}

.character-notes-reference {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-self: start;
  max-height: min(76vh, 820px);
  padding: 18px;
  overflow: hidden;

  background: rgba(255, 255, 255, 0.42);
  border: 1px solid rgba(137, 107, 67, 0.24);
  border-radius: 8px;
}

.vampire-sheet-app .character-notes-reference {
  background: rgba(255, 255, 255, 0.035);
  border-color: rgba(179, 144, 96, 0.24);
}

.character-notes-reference h2,
.character-notes-reference h3 {
  margin: 0;
}

.character-notes-reference h2 {
  color: #241716;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.45rem;
}

.vampire-sheet-app .character-notes-reference h2 {
  color: #f0d7b0;
}

.character-notes-reference h3 {
  padding-top: 10px;
  color: #7b5932;
  border-top: 1px solid rgba(137, 107, 67, 0.2);
  font-size: 0.88rem;
  font-weight: 900;
  text-transform: uppercase;
}

.vampire-sheet-app .character-notes-reference h3 {
  color: #d5a96c;
  border-top-color: rgba(179, 144, 96, 0.22);
}

.character-notes-facts {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 7px 10px;
  margin: 0;
}

.character-notes-facts dd {
  margin: 0;
  color: #49382d;
}

.vampire-sheet-app .character-notes-facts dd {
  color: #dfc8b8;
}

.character-notes-reference-scroll {
  display: grid;
  align-content: start;
  gap: 14px;
  flex: 1 1 auto;
  min-height: 150px;
  padding-right: 4px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.character-notes-reference-scroll::-webkit-scrollbar {
  width: 8px;
}

.character-notes-reference-scroll::-webkit-scrollbar-thumb {
  background: rgba(122, 91, 52, 0.34);
  border-radius: 999px;
}

.vampire-sheet-app .character-notes-reference-scroll::-webkit-scrollbar-thumb {
  background: rgba(179, 144, 96, 0.34);
}

.character-notes-reference-section {
  display: grid;
  gap: 8px;
}

.character-notes-reference-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.character-notes-reference-list li {
  min-width: 0;
}

.character-notes-reference-card {
  display: grid;
  gap: 3px;
  width: 100%;
  min-width: 0;
  padding: 9px 10px;

  color: inherit;
  background: rgba(255, 255, 255, 0.42);
  border: 1px solid rgba(137, 107, 67, 0.16);
  border-radius: 7px;

  font: inherit;
  text-align: left;
  cursor: pointer;
  transition:
    background 150ms ease,
    border-color 150ms ease,
    transform 150ms ease;
}

.character-notes-reference-card:hover,
.character-notes-reference-card:focus-visible {
  background: rgba(255, 255, 255, 0.7);
  border-color: rgba(122, 31, 31, 0.28);
  transform: translateY(-1px);
}

.character-notes-reference-card:focus-visible {
  outline: 3px solid rgba(122, 31, 31, 0.2);
  outline-offset: 2px;
}

.vampire-sheet-app .character-notes-reference-card {
  background: rgba(255, 255, 255, 0.035);
  border-color: rgba(179, 144, 96, 0.16);
}

.vampire-sheet-app .character-notes-reference-card:hover,
.vampire-sheet-app .character-notes-reference-card:focus-visible {
  background: rgba(193, 154, 98, 0.1);
  border-color: rgba(179, 144, 96, 0.36);
}

.vampire-sheet-app .character-notes-reference-card:focus-visible {
  outline-color: rgba(179, 144, 96, 0.28);
}

.character-notes-reference-card strong {
  overflow: hidden;
  color: #241716;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vampire-sheet-app .character-notes-reference-card strong {
  color: #f0d7b0;
}

.character-notes-reference-card span,
.character-notes-empty {
  margin: 0;
  color: #6c5a49;
  font-size: 0.84rem;
  line-height: 1.45;
}

.vampire-sheet-app .character-notes-reference-card span,
.vampire-sheet-app .character-notes-empty {
  color: #bfaea3;
}

@media (max-width: 900px) {
  .character-notes {
    grid-template-columns: 1fr;
    width: min(100%, calc(100vw - 24px));
    padding: 18px;
  }

  .character-notes-topbar,
  .character-notes-selector {
    align-items: stretch;
    flex-direction: column;
  }

  .character-notes-nav-actions,
  .character-notes-back,
  .character-notes-new,
  .character-notes-delete {
    width: 100%;
  }

  .character-notes-reference {
    max-height: none;
  }

  .character-notes-reference-scroll {
    max-height: 46vh;
  }

  .character-notes-editor,
  .character-notes-preview {
    min-height: 52vh;
    padding: 18px;
  }
}
