* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #121212; color: #fff; min-height: 100vh;
  display: flex; justify-content: center; padding: 2rem 1rem;
}
.app { max-width: 700px; width: 100%; }

.header { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1.5rem; }
.header img { width: 40px; height: 40px; }
.header h1 { font-size: 1.8rem; color: #1DB954; }

h2 { font-size: 1.1rem; margin-bottom: 0.5rem; color: #b3b3b3; }

.section { margin-bottom: 1.5rem; }

input[type="text"] {
  width: 100%; padding: 0.75rem; border: 1px solid #333; border-radius: 8px;
  background: #1e1e1e; color: #fff; font-size: 0.95rem; outline: none;
}
input[type="text"]:focus { border-color: #1DB954; }

.song-editor {
  width: 100%; border: 1px solid #333; border-radius: 8px;
  background: #1e1e1e; min-height: 180px; overflow: hidden;
}
.song-editor:focus-within { border-color: #1DB954; }
.song-line {
  display: flex; align-items: center; padding: 0 0.75rem; min-height: 2.2rem;
  font-family: monospace; font-size: 0.95rem; transition: background 0.15s;
}
.song-line:nth-child(odd) { background: #1e1e1e; }
.song-line:nth-child(even) { background: #252525; }
.song-line.dragging { opacity: 0.4; }
.song-line.drag-over-line { border-top: 2px solid #1DB954; margin-top: -2px; }
.song-line .drag-handle {
  cursor: grab; color: #444; font-size: 1rem; padding: 0 0.25rem; user-select: none;
}
.song-line .drag-handle:active { cursor: grabbing; }
.song-line .drag-handle:hover { color: #1DB954; }
.song-line .line-num {
  color: #555; font-size: 0.8rem; min-width: 1.5rem; user-select: none;
}
.song-line input {
  flex: 1; background: transparent; border: none; color: #fff;
  font-family: monospace; font-size: 0.95rem; outline: none; padding: 0.4rem 0;
}
.song-line .remove-btn {
  background: none; border: none; color: #555; cursor: pointer;
  font-size: 1.1rem; padding: 0 0.25rem; line-height: 1;
}
.song-line .remove-btn:hover { color: #e74c3c; }
.add-line-btn {
  width: 100%; background: transparent; border: none; border-top: 1px solid #2a2a2a;
  color: #555; padding: 0.5rem; cursor: pointer; font-size: 0.85rem; text-align: left;
  padding-left: 3.5rem;
}
.add-line-btn:hover { color: #1DB954; }

button {
  padding: 0.75rem 1.5rem; border: none; border-radius: 24px;
  font-size: 0.95rem; font-weight: 600; cursor: pointer; transition: all 0.2s;
}
.btn-primary { background: #1DB954; color: #000; }
.btn-primary:hover { background: #1ed760; transform: scale(1.02); }
.btn-primary:disabled { background: #535353; color: #b3b3b3; cursor: not-allowed; transform: none; }

.login-section { text-align: center; padding: 3rem 0; }
.login-section p { color: #b3b3b3; margin-bottom: 1rem; }
.login-error { color: #e74c3c; background: #3a1a1a; padding: 0.75rem 1rem; border-radius: 8px; font-size: 0.85rem; margin-top: 1rem; }
.user-info { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1.5rem; color: #b3b3b3; font-size: 0.9rem; }
.user-info img { width: 32px; height: 32px; border-radius: 50%; }
.logout-btn { background: none; border: none; color: #b3b3b3; cursor: pointer; font-size: 0.85rem; padding: 0; text-decoration: underline; }

.drop-zone {
  border: 2px dashed #333; border-radius: 8px; padding: 2rem; text-align: center;
  color: #b3b3b3; cursor: pointer; transition: all 0.2s; margin-bottom: 0.75rem;
}
.drop-zone:hover, .drop-zone.drag-over { border-color: #1DB954; color: #1DB954; }
.drop-zone input { display: none; }

.ocr-status { color: #b3b3b3; font-size: 0.85rem; margin-bottom: 0.5rem; }
.ocr-status.processing { color: #f0b429; }

.track-list { list-style: none; }
.track-item {
  display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem;
  border-radius: 8px; margin-bottom: 0.25rem;
}
.track-item:hover { background: #1e1e1e; }
.track-item img { width: 40px; height: 40px; border-radius: 4px; }
.track-item .info { flex: 1; min-width: 0; }
.track-item .name { font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-item .artist { font-size: 0.8rem; color: #b3b3b3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-item.not-found { opacity: 0.5; }
.track-item.not-found .name { color: #e74c3c; }
.track-item input[type="checkbox"] { accent-color: #1DB954; width: 18px; height: 18px; }

.result-msg { padding: 1rem; border-radius: 8px; margin-top: 1rem; }
.result-msg.success { background: #1a3a2a; color: #1DB954; }
.result-msg.error { background: #3a1a1a; color: #e74c3c; }

.actions { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 1rem; }

.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid #333; border-top-color: #1DB954; border-radius: 50%; animation: spin 0.6s linear infinite; vertical-align: middle; margin-right: 0.5rem; }
@keyframes spin { to { transform: rotate(360deg); } }

.hidden { display: none; }
