* { box-sizing: border-box; }

body {
  font-family: system-ui, -apple-system, sans-serif;
  max-width: 720px;
  margin: 0 auto;
  padding: 1rem;
  color: #222;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

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

.header-actions { display: flex; gap: 0.5rem; align-items: center; }

#refresh {
  background: none;
  border: 1px solid #ccc;
  border-radius: 4px;
  width: 2rem;
  height: 2rem;
  cursor: pointer;
  font-size: 1rem;
}

#toggle-deleted {
  background: none;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 0.3rem 0.6rem;
  cursor: pointer;
  font-size: 0.85rem;
  white-space: nowrap;
}

#toggle-deleted:disabled { color: #bbb; border-color: #eee; cursor: not-allowed; }
#toggle-deleted.active { background: #444; color: #fff; border-color: #444; }

.section-header {
  list-style: none;
  font-size: 0.85rem;
  font-weight: 600;
  color: #888;
  letter-spacing: 0.05em;
  padding: 1rem 0 0.25rem;
  margin-top: 0.5rem;
  border-top: 1px solid #eee;
}

#add-form {
  display: flex;
  gap: 0.5rem;
  margin: 1rem 0;
}

#url-input {
  flex: 1;
  padding: 0.5rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font: inherit;
}

#add-form button {
  padding: 0.5rem 1rem;
  border: 1px solid #444;
  background: #444;
  color: #fff;
  border-radius: 4px;
  cursor: pointer;
}

#status {
  min-height: 1.5rem;
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 0.5rem;
}

#status.error { color: #c00; }

#songs {
  list-style: none;
  padding: 0;
  margin: 0;
}

.song {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid #eee;
}

.song.deleted img { filter: grayscale(1); opacity: 0.5; }

.song img {
  width: 120px;
  height: 68px;
  object-fit: cover;
  border-radius: 4px;
  background: #eee;
}

.song-info {
  flex: 1;
  min-width: 0;
}

.song-link {
  display: block;
  color: inherit;
  text-decoration: none;
  min-width: 0;
}

.song-link:hover .song-title,
.song-link:hover .song-url { text-decoration: underline; }

.song-title {
  font-weight: 600;
  color: #222;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.song-channel {
  font-size: 0.85rem;
  color: #666;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.song-url {
  font-size: 0.9rem;
  color: #06c;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.song.deleted .song-title,
.song.deleted .song-url { text-decoration: line-through; }

.song-meta {
  font-size: 0.85rem;
  color: #666;
  margin: 0.25rem 0;
}

.actions {
  display: flex;
  gap: 0.25rem;
}

.actions button {
  font-size: 0.85rem;
  padding: 0.2rem 0.5rem;
  border: 1px solid #ccc;
  background: #fff;
  border-radius: 3px;
  cursor: pointer;
}

.actions button:hover { background: #f5f5f5; }

.history {
  font-size: 0.8rem;
  color: #555;
  margin-top: 0.5rem;
  padding: 0.5rem;
  background: #f7f7f7;
  border-radius: 4px;
}

.history.hidden { display: none; }

.history-entry {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  padding: 0.15rem 0;
}

.comments {
  font-size: 0.85rem;
  color: #333;
  margin-top: 0.5rem;
  padding: 0.5rem 0.6rem;
  background: #f7f7f7;
  border-radius: 4px;
}

.comments.hidden { display: none; }

.comment-entry {
  padding: 0.4rem 0;
  border-bottom: 1px solid #eaeaea;
}

.comment-entry:last-of-type { border-bottom: none; }

.comment-head {
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
  margin-bottom: 0.15rem;
}

.comment-head strong { font-size: 0.85rem; color: #222; }

.comment-time {
  font-size: 0.75rem;
  color: #888;
}

.comment-body {
  white-space: pre-wrap;
  word-break: break-word;
  color: #333;
}

.comment-add { margin-top: 0.5rem; }

.comment-add > button {
  font-size: 0.8rem;
  padding: 0.2rem 0.5rem;
  border: 1px dashed #bbb;
  background: transparent;
  color: #555;
  border-radius: 3px;
  cursor: pointer;
}

.comment-add > button:hover { background: #efefef; }

.comment-form {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.comment-form.hidden { display: none; }

.comment-form input,
.comment-form textarea {
  padding: 0.4rem;
  border: 1px solid #ccc;
  border-radius: 3px;
  font: inherit;
  font-size: 0.85rem;
  resize: vertical;
}

.comment-form-actions { display: flex; gap: 0.3rem; }

.comment-form-actions button {
  font-size: 0.8rem;
  padding: 0.25rem 0.6rem;
  border: 1px solid #ccc;
  background: #fff;
  border-radius: 3px;
  cursor: pointer;
}

.comment-form-actions button[type="submit"] {
  background: #444;
  color: #fff;
  border-color: #444;
}
