:root {
  --radius: 12px;
  --transition: 0.2s ease;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  transition: background var(--transition), color var(--transition);
}

#app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.app-header h1 { font-size: 1.8rem; }

.btn-primary, .btn-secondary, .btn-danger {
  padding: 10px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover { filter: brightness(1.1); }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
}
.btn-secondary:hover { background: var(--border); }

.btn-danger {
  background: #ef4444;
  color: #fff;
  border-color: #ef4444;
}
.btn-danger:hover { filter: brightness(1.1); }

.board-container {
  position: relative;
}

.loading {
  text-align: center;
  padding: 40px;
  color: var(--muted);
}

.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.note-card {
  background: #fff9c4;
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  min-height: 180px;
  transition: transform var(--transition);
}
.note-card:hover { transform: translateY(-2px); }

.note-content {
  flex-grow: 1;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-size: 1rem;
  margin-bottom: 12px;
}

.note-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  padding: 4px;
  border-radius: 6px;
  transition: background var(--transition);
}
.icon-btn:hover { background: rgba(0,0,0,0.1); }

.empty-state {
  text-align: center;
  padding: 40px;
  color: var(--muted);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 500px;
  box-shadow: var(--shadow);
}

.modal-sm { max-width: 400px; }

.modal h2 { margin-bottom: 16px; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 600; }
textarea, input[type='text'] {
  width: 100%;
  padding: 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
  resize: vertical;
}
textarea:focus, input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.error-text {
  color: #ef4444;
  font-size: 0.85rem;
  margin-top: 4px;
}

.color-options {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.color-option {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.color-option input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.color-option:has(input:checked) {
  border-color: var(--text);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 20px;
}

@media (max-width: 600px) {
  .notes-grid {
    grid-template-columns: 1fr;
  }
}