body {
  margin: 0;
  font-family: 'Segoe UI', Arial, sans-serif;
  background: #f5f6fa;
  min-height: 100vh;
}

body.dark-mode {
  background: #181a1b;
  color: #eaeaea;
}

body.dark-mode .app-header {
  background: linear-gradient(90deg, #23272a 0%, #181a1b 100%);
  box-shadow: 0 4px 18px rgba(0,0,0,0.25);
}
body.dark-mode .header-title {
  color: #ffe066;
}
body.dark-mode .search-wrapper {
  background: #23272a;
  border: 1px solid #444;
}
body.dark-mode .search-icon {
  color: #ffe066;
}
body.dark-mode #search-notes {
  color: #eaeaea;
}
body.dark-mode #search-notes::placeholder {
  color: #888;
}
body.dark-mode #add-note-btn {
  background: linear-gradient(90deg, #23272a 0%, #444 100%);
  color: #ffe066;
}
body.dark-mode #add-note-btn:hover {
  background: linear-gradient(90deg, #444 0%, #23272a 100%);
}
body.dark-mode .notes-board {
  /* no change needed */
}
body.dark-mode .sticky-note {
  background: #23272a;
  color: #222;
  box-shadow: 0 4px 16px rgba(0,0,0,0.35);
}
body.dark-mode .sticky-note-header {
  background: rgba(255,255,255,0.04);
  color: #bbb;
}
body.dark-mode .sticky-note-header:active {
  background: rgba(255,255,255,0.10);
}
body.dark-mode .sticky-note-header-btns .color-btn:hover {
  background: #444;
}
body.dark-mode .sticky-note-header-btns .delete-btn:hover {
  background: #ff7875;
}
body.dark-mode .sticky-note-content {
  color: #222;
  background: transparent;
}
body.dark-mode .sticky-note-content[placeholder]:empty:before {
  color: #888;
}
body.dark-mode .sticky-note-toolbar button, body.dark-mode .sticky-note-toolbar select {
  color: #222;
}
body.dark-mode .sticky-note-toolbar button:hover, body.dark-mode .sticky-note-toolbar select:hover {
  background: #23272a;
}
body.dark-mode .sticky-note-toolbar button:focus, body.dark-mode .sticky-note-toolbar select:focus {
  background: #444;
  box-shadow: 0 0 0 2px #ffe066;
}
body.dark-mode .color-picker-modal {
  background: rgba(0,0,0,0.55);
}
body.dark-mode .color-picker-content {
  background: #23272a;
  color: #eaeaea;
}
body.dark-mode .color-option {
  border: 2px solid #444;
}
body.dark-mode .color-option.selected {
  border: 2px solid #ffe066;
}
body.dark-mode #close-color-picker {
  background: #444;
  color: #eaeaea;
}
body.dark-mode #close-color-picker:hover {
  background: #23272a;
}
body.dark-mode .custom-tooltip {
  background: #444;
  color: #ffe066;
}
body.dark-mode .custom-tooltip::after {
  border-color: #444 transparent transparent transparent;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.2rem 2.2rem;
  background: linear-gradient(90deg, #fffbe6 0%, #fff 100%);
  box-shadow: 0 4px 18px rgba(0,0,0,0.07);
  border-radius: 0 0 18px 18px;
  margin-bottom: 0.5rem;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}
.header-logo {
  font-size: 2.2rem;
  margin-right: 0.2rem;
}
.header-title {
  font-size: 2.1rem;
  font-weight: 700;
  color: #ffb300;
  margin: 0;
  letter-spacing: 0.02em;
}

.header-center {
  flex: 1;
  display: flex;
  justify-content: center;
}
.search-wrapper {
  display: flex;
  align-items: center;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  padding: 0.1rem 0.8rem;
  transition: box-shadow 0.2s;
  border: 1px solid #f5e6b6;
}
.search-wrapper:focus-within {
  box-shadow: 0 4px 16px rgba(255,218,71,0.13);
  border-color: #ffda47;
}
.search-icon {
  font-size: 1.2rem;
  color: #ffb300;
  margin-right: 0.5rem;
}
#search-notes {
  border: none;
  outline: none;
  background: transparent;
  font-size: 1.08rem;
  padding: 0.4rem 0.2rem;
  min-width: 180px;
  color: #222;
}
#search-notes::placeholder {
  color: #bbb;
  font-weight: 400;
}

.header-right {
  display: flex;
  align-items: center;
}
#add-note-btn {
  background: linear-gradient(90deg, #ffda47 0%, #ffe066 100%);
  color: #222;
  border: none;
  border-radius: 10px;
  padding: 0.6rem 1.4rem;
  font-size: 1.08rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(255,218,71,0.13);
  transition: background 0.2s, box-shadow 0.2s, transform 0.18s;
  margin-left: 0.8rem;
}

.dark-toggle-btn {
  margin-left: 1.2rem;
  font-size: 1.5rem;
  padding: 0.5rem 1rem;
  border-radius: 50%;
  border: none;
  background: linear-gradient(90deg, #ffe066 0%, #ffda47 100%);
  color: #222;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(255,218,71,0.13);
  transition: background 0.2s, box-shadow 0.2s, transform 0.18s;
}
.dark-toggle-btn:hover, .dark-toggle-btn:focus {
  background: linear-gradient(90deg, #ffda47 0%, #ffe066 100%);
  box-shadow: 0 4px 16px rgba(255,218,71,0.18);
  transform: scale(1.08);
  outline: 2px solid #ffda47;
}

body.dark-mode .dark-toggle-btn {
  background: linear-gradient(90deg, #23272a 0%, #444 100%);
  color: #ffe066;
}
body.dark-mode .dark-toggle-btn:hover, body.dark-mode .dark-toggle-btn:focus {
  background: linear-gradient(90deg, #444 0%, #23272a 100%);
  outline: 2px solid #ffe066;
}

.notes-board {
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem;
  padding: 2rem;
  min-height: 70vh;
}

.sticky-note {
  position: absolute;
  min-width: 220px;
  min-height: 140px;
  max-width: 800px;
  background: #fffbe6;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.10);
  padding: 0.7rem;
  padding-top: 2.2rem;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.2s, transform 0.2s, background 0.3s;
  z-index: 1;
  user-select: none;
  animation: fadeIn 0.4s;
  /* Remove fixed width/height so inline style always wins */
  width: auto;
  height: auto;
}


.sticky-note-resize {
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 18px;
  height: 18px;
  background: transparent;
  border-radius: 4px;
  cursor: nwse-resize;
  z-index: 3;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
}
.sticky-note-resize:after {
  content: '';
  display: none;
}
.sticky-note-resize:hover {
  background: transparent;
}

.sticky-note-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2rem;
  background: rgba(0,0,0,0.04);
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
  display: flex;
  align-items: center;
  padding-left: 1rem;
  padding-right: 0.5rem;
  font-size: 1rem;
  color: #888;
  user-select: none;
  z-index: 2;
}
.sticky-note-header:active {
  background: rgba(0,0,0,0.10);
}

.sticky-note-header-btns {
  display: flex;
  gap: 0.2rem;
  align-items: center;
  margin-left: auto;
}

.sticky-note-header-btns .color-btn,
.sticky-note-header-btns .delete-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: background 0.2s;
}
.sticky-note-header-btns .color-btn:hover {
  background: #ffe066;
}
.sticky-note-header-btns .delete-btn:hover {
  background: #ff7875;
}

.sticky-note:focus-within {
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  outline: 2px solid #ffda47;
}
.sticky-note:hover {
  box-shadow: 0 8px 32px rgba(0,0,0,0.14);
}


.sticky-note.fadeOut {
  animation: fadeOut 0.3s forwards;
}

@keyframes fadeOut {
  to { opacity: 0; transform: scale(0.95); }
}

.sticky-note.dragging {
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  transform: scale(1.04);
  z-index: 10;
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.sticky-note-content {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 1rem;
  color: #222;
  outline: none;
  margin-bottom: 0.5rem;
  min-height: 60px;
  padding: 0.2rem;
  word-break: break-word;
}

.sticky-note-content[placeholder]:empty:before {
  content: attr(placeholder);
  color: #aaa;
}

.sticky-note-toolbar {
  display: flex;
  gap: 0.18rem;
  align-items: center;
  margin-bottom: 0.18rem;
  margin-top: 0.12rem;
  background: transparent;
  box-shadow: none;
}
.sticky-note-toolbar button, .sticky-note-toolbar select {
  background: transparent;
  border: none;
  border-radius: 6px;
  padding: 0.08rem 0.22rem;
  font-size: 1rem;
  font-weight: 500;
  color: #444;
  cursor: pointer;
  transition: background 0.18s, box-shadow 0.18s;
  outline: none;
  box-shadow: none;
}
.sticky-note-toolbar button:hover, .sticky-note-toolbar select:hover {
  background: #fffbe6;
  box-shadow: 0 1px 4px rgba(255,218,71,0.08);
}
.sticky-note-toolbar button:focus, .sticky-note-toolbar select:focus {
  background: #ffe066;
  box-shadow: 0 0 0 2px #ffe066;
}
.sticky-note-toolbar select {
  padding-right: 0.5rem;
}

.sticky-note-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sticky-note .color-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  margin-right: 0.5rem;
  cursor: pointer;
  outline: none;
  box-shadow: 0 1px 4px rgba(0,0,0,0.10);
  transition: border 0.2s, box-shadow 0.2s;
}
.sticky-note .color-btn:focus {
  box-shadow: 0 0 0 2px #ffda47;
}

.sticky-note .color-btn.selected {
  border: 2px solid #222;
}

.sticky-note .delete-btn {
  background: #ff4d4f;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.2rem 0.7rem;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
}
.sticky-note .delete-btn:focus {
  box-shadow: 0 0 0 2px #ff7875;
}

.sticky-note .delete-btn:hover {
  background: #ff7875;
}

.color-picker-modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.color-picker-modal.hidden {
  display: none;
}
.color-picker-content {
  background: #fff;
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  min-width: 280px;
  text-align: center;
}
.color-options {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin: 1rem 0 2rem 0;
}
.color-option {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid #eee;
  cursor: pointer;
  transition: border 0.2s;
}
.color-option.selected {
  border: 2px solid #222;
}

#close-color-picker {
  background: #eee;
  border: none;
  border-radius: 8px;
  padding: 0.5rem 1.2rem;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s;
}
#close-color-picker:hover {
  background: #ddd;
}

@media (max-width: 700px) {
  .notes-board {
    padding: 1rem;
    gap: 0.7rem;
  }
  .sticky-note {
    min-width: 160px;
    max-width: 90vw;
    padding: 0.7rem;
  }
  .app-header {
    flex-direction: column;
    align-items: stretch;
    padding: 0.7rem 0.5rem;
    border-radius: 0 0 12px 12px;
  }
  .header-left {
    justify-content: center;
    margin-bottom: 0.5rem;
  }
  .header-center {
    justify-content: center;
    margin-bottom: 0.5rem;
  }
  .header-right {
    justify-content: center;
  }
  #search-notes {
    min-width: 120px;
    font-size: 1rem;
  }
}

.custom-tooltip {
  position: fixed;
  z-index: 9999;
  background: #222;
  color: #fff;
  padding: 0.45em 0.9em;
  border-radius: 8px;
  font-size: 0.98rem;
  font-weight: 500;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
  pointer-events: none;
  opacity: 0;
  transform: translateY(-8px) scale(0.98);
  transition: opacity 0.18s, transform 0.18s;
  white-space: nowrap;
}
.custom-tooltip:not(.hidden) {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.custom-tooltip::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translateX(-50%);
  border-width: 8px 8px 0 8px;
  border-style: solid;
  border-color: #222 transparent transparent transparent;
}
.hidden {
  display: none !important;
}
