.note-container {
  box-sizing: content-box;
  display: inline-block;
  position: relative;
}

.note-container > picture,
.note-container > picture > img,
.note-container > img,
.note-container > video {
  display: block;
}

.note-container.hide-notes .note-box {
  visibility: hidden;
}

.note-box {
  align-items: center;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--theme-accent, #ffff33);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28);
  box-sizing: content-box;
  cursor: move;
  display: flex;
  justify-content: center;
  min-height: 5px;
  min-width: 5px;
  opacity: 0.48;
  position: absolute;
  text-align: center;
  z-index: 100;
}

.note-box:hover,
.note-box.movable {
  opacity: 0.7;
  z-index: 200;
}

.note-box.unsaved {
  border-color: #ff4d5a;
}

.note-box.movable {
  border-color: #38bdf8;
  outline: 1px solid #38bdf8;
}

.note-box.note-box-highlighted {
  outline: 2px solid #ff4d5a;
}

.note-resize-handle {
  background: var(--theme-accent, #ffff33);
  border: 1px solid rgba(0, 0, 0, 0.45);
  box-sizing: border-box;
  height: 10px;
  position: absolute;
  width: 10px;
}

.note-resize-nw {
  cursor: nwse-resize;
  left: -5px;
  top: -5px;
}

.note-resize-se {
  bottom: -5px;
  cursor: nwse-resize;
  right: -5px;
}

.note-body {
  background: var(--theme-card-bg, #ffffff);
  border: 1px solid var(--theme-border, #888);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
  box-sizing: border-box;
  color: var(--theme-text, #111);
  cursor: pointer;
  font-size: 14px;
  line-height: 1.25;
  max-width: min(420px, 90vw);
  min-width: 140px;
  overflow-wrap: break-word;
  padding: 6px 8px;
  position: absolute;
  text-align: left;
  z-index: 300;
}

#note-preview {
  background: rgba(255, 255, 51, 0.32);
  border: 1px solid #ff4d5a;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22);
  box-sizing: content-box;
  cursor: crosshair;
  position: absolute;
  z-index: 250;
}

body.mode-translation .note-container {
  cursor: crosshair;
}

#translate.is-active {
  filter: brightness(1.15);
  outline: 2px solid var(--theme-accent, #ffff33);
}

.note-edit-dialog {
  background: var(--theme-card-bg, #fff);
  border: 1px solid var(--theme-border, #777);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.34);
  color: var(--theme-text, #111);
  display: grid;
  gap: 8px;
  max-width: min(420px, calc(100vw - 24px));
  padding: 10px;
  position: fixed;
  right: 18px;
  top: 88px;
  width: 360px;
  z-index: 10000;
}

.note-edit-dialog-header,
.note-edit-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.note-edit-dialog-header {
  justify-content: space-between;
}

.note-edit-dialog textarea {
  box-sizing: border-box;
  min-height: 150px;
  resize: vertical;
  width: 100%;
}

.note-edit-actions button,
.note-edit-actions a,
.note-edit-dialog-header button {
  min-height: 30px;
}

.note-edit-hint,
.note-editor-status {
  font-size: 12px;
  margin: 0;
}

.note-editor-status {
  color: #ff4d5a;
  min-height: 1.2em;
}

@media (max-width: 700px) {
  .note-edit-dialog {
    left: 10px;
    right: 10px;
    top: 64px;
    width: auto;
  }
}
