:root {
  color-scheme: light dark;
  --bg: #fafafa;
  --fg: #1a1a1a;
  --muted: #666;
  --border: #ddd;
  --accent: #d6336c;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15151a;
    --fg: #eee;
    --muted: #999;
    --border: #333;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

header .brand {
  font-weight: 600;
  color: var(--fg);
  text-decoration: none;
}

header .logout {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
}

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.5rem;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 280px;
  margin: 3rem auto;
}

.login-form input, .login-form button {
  padding: 0.6rem;
  font-size: 1rem;
}

.error { color: var(--accent); }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.filters input, .filters select, .filters button {
  padding: 0.4rem 0.6rem;
}

.like-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.like-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.like-main {
  flex: 1;
  color: var(--fg);
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.like-main .caption {
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.badge {
  background: var(--accent);
  color: white;
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
}

.kind-badge {
  background: var(--border);
  color: var(--muted);
}

.ig-link {
  color: var(--muted);
  font-size: 0.85rem;
  text-decoration: none;
  white-space: nowrap;
}

.empty { color: var(--muted); padding: 1rem 0; }

.result-count { color: var(--muted); font-size: 0.85rem; margin: 0 0 0.75rem; }

.record-number {
  color: var(--muted);
  font-size: 0.8rem;
  min-width: 1.5rem;
}

.delete-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 0.2rem 0.4rem;
}

.delete-btn:hover { color: var(--accent); }

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin: 1.5rem 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.pagination a { color: var(--fg); text-decoration: none; }

.back {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
}

.caption-full { white-space: pre-wrap; }

.meta { color: var(--muted); font-size: 0.85rem; }

.suggest-form { margin: 1rem 0 0.5rem; }

.suggest-form button {
  background: none;
  border: 1px solid var(--border);
  color: var(--fg);
  padding: 0.4rem 0.9rem;
  border-radius: 6px;
  cursor: pointer;
}

.hint { color: var(--muted); font-size: 0.85rem; }

.edit-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.5rem;
}

.edit-form label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.edit-form input, .edit-form textarea {
  padding: 0.5rem;
  font-size: 1rem;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--fg);
}

.edit-form button {
  align-self: flex-start;
  padding: 0.5rem 1.2rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.embed-wrap {
  margin: 1rem 0;
  max-width: 540px;
}

.embed-wrap iframe {
  width: 100%;
  min-height: 600px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.detail-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
}

.detail-actions form button.delete-btn {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
}

.category-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.category-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 1rem;
}

.category-row .name { flex: 1; }

.category-row .count { color: var(--muted); font-size: 0.85rem; }

.create-category-form {
  display: flex;
  gap: 0.5rem;
}

.create-category-form input {
  flex: 1;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--fg);
}

.create-category-form button {
  padding: 0.5rem 1.2rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}
