:root {
  color-scheme: light;
  font-family: "Inter", system-ui, sans-serif;
  background: #f5f5f7;
  color: #1f1f24;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
}

.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 2rem;
  background: #ffffff;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  gap: 1.5rem;
  flex-wrap: wrap;
}

header h1 {
  margin: 0;
  font-size: 1.5rem;
}

.actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.api-config {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: #4b5563;
}

.api-config input {
  width: 220px;
  padding: 0.45rem 0.7rem;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  font-size: 0.9rem;
}

button {
  border: none;
  background: #4c6ef5;
  color: #fff;
  padding: 0.6rem 1rem;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
}

button:hover {
  background: #3b5bdb;
}

button.subtle {
  background: transparent;
  color: #6b7280;
  padding: 0.35rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 500;
}

button.subtle:hover {
  background: #f3f4f6;
  color: #374151;
}

button.danger {
  background: #ef4444;
}

button.danger:hover {
  background: #dc2626;
}

#sync-status {
  font-size: 0.9rem;
  color: #4b5563;
}

main {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1.5rem;
  padding: 2rem;
  flex: 1;
}

aside {
  background: #ffffff;
  padding: 1rem;
  border-radius: 16px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

#memo-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.memo-item {
  padding: 0.6rem 0.8rem;
  border-radius: 12px;
  cursor: pointer;
  background: #f1f5f9;
}

.memo-item.active {
  background: #dbe4ff;
  font-weight: 600;
}

.editor {
  background: #ffffff;
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.editor-header {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.search-replace {
  display: grid;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.search-field label {
  font-size: 0.85rem;
  color: #4b5563;
  min-width: 60px;
}

.search-field input {
  flex: 1;
  padding: 0.45rem 0.7rem;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  font-size: 0.95rem;
}

.search-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: #4b5563;
}

.search-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.search-actions button {
  padding: 0.45rem 0.9rem;
  font-size: 0.85rem;
}

#search-status {
  font-size: 0.85rem;
  color: #4b5563;
}

#memo-title {
  flex: 1;
  padding: 0.5rem 0.8rem;
  font-size: 1rem;
  border-radius: 10px;
  border: 1px solid #d1d5db;
}

#memo-content {
  min-height: 280px;
  padding: 0.8rem;
  border-radius: 12px;
  border: 1px solid #d1d5db;
  font-size: 1rem;
  line-height: 1.5;
}

.history {
  border-top: 1px solid #e5e7eb;
  padding-top: 1rem;
}

#history-list {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background: #f8fafc;
  border-radius: 10px;
  font-size: 0.9rem;
}

.history-item button {
  padding: 0.4rem 0.7rem;
  font-size: 0.8rem;
}

@media (max-width: 900px) {
  main {
    grid-template-columns: 1fr;
  }
}
