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

body {
  font-family: "Roboto", system-ui, -apple-system, sans-serif;
  background: #0f0f0f;
  color: #f1f1f1;
  line-height: 1.6;
  overflow-x: hidden;
}

/* ── Top bar ──────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #0f0f0f;
  padding: 0 16px;
}

.topbar-inner {
  max-width: 1800px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  height: 56px;
  gap: 12px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 2px;
  text-decoration: none;
  color: #fff;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.5px;
  flex-shrink: 0;
  margin-right: 8px;
}

.logo sup {
  font-size: 0.55rem;
  color: #aaa;
  font-weight: 400;
  vertical-align: super;
  margin-left: 1px;
}

/* ── Search ───────────────────────────────────────────── */
.search-form {
  flex: 1;
  max-width: 640px;
  display: flex;
  margin: 0 auto;
}

.search-form input {
  flex: 1;
  padding: 0 16px;
  height: 40px;
  background: #121212;
  border: 1px solid #303030;
  border-right: 0;
  border-radius: 20px 0 0 20px;
  color: #fff;
  font-size: 1rem;
  outline: none;
}

.search-form input:focus {
  border-color: #1c62b9;
}

.search-form .search-btn {
  width: 64px;
  height: 40px;
  background: #222;
  border: 1px solid #303030;
  border-radius: 0 20px 20px 0;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.search-form .search-btn:hover {
  background: #333;
}

/* ── Top bar right ────────────────────────────────────── */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
}

.btn-upload {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: #222;
  color: #fff;
  border: 0;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s;
}

.btn-upload:hover {
  background: #333;
}

.avatar-wrap {
  position: relative;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #7c4dff;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  border: 0;
  cursor: pointer;
  overflow: hidden;
  padding: 0;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.avatar-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 8px;
  min-width: 120px;
  z-index: 300;
}

.avatar-wrap.open .avatar-dropdown {
  display: block;
}

.avatar-dropdown a {
  display: block;
  padding: 10px 16px;
  color: #f1f1f1;
  text-decoration: none;
  font-size: 0.85rem;
  transition: background 0.15s;
}

.avatar-dropdown a:hover {
  background: #2a2a2a;
}

.avatar-dropdown a:first-child {
  border-radius: 8px 8px 0 0;
}

.avatar-dropdown a:last-child {
  border-radius: 0 0 8px 8px;
}

/* ── Main ──────────────────────────────────────────────── */
main {
  max-width: 1800px;
  margin: 0 auto;
  padding: 24px 32px;
}

/* ── Upload modal ─────────────────────────────────────── */
.upload-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 200;
  align-items: center;
  justify-content: center;
}

.upload-overlay.active {
  display: flex;
}

.upload-modal {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 16px;
  padding: 32px;
  width: 100%;
  max-width: 480px;
}

.upload-modal h2 {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.upload-modal .close-btn {
  margin-left: auto;
  background: none;
  border: 0;
  color: #aaa;
  font-size: 1.4rem;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

.upload-modal .close-btn:hover {
  color: #fff;
}

.upload-modal .upload-area {
  border: 2px dashed #444;
  border-radius: 12px;
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s;
  margin-bottom: 16px;
}

.upload-modal .upload-area:hover {
  border-color: #1c62b9;
}

.upload-modal .upload-area svg {
  margin-bottom: 12px;
}

.upload-modal .upload-area p {
  color: #aaa;
  font-size: 0.9rem;
}

.upload-modal .upload-area .browse-link {
  color: #1c62b9;
  text-decoration: underline;
  cursor: pointer;
}

.upload-modal input[type="text"],
.upload-modal input[type="url"] {
  width: 100%;
  padding: 12px 14px;
  background: #121212;
  border: 1px solid #333;
  border-radius: 8px;
  color: #fff;
  font-size: 0.95rem;
  outline: none;
  margin-bottom: 16px;
}

.upload-modal input[type="text"]::placeholder,
.upload-modal input[type="url"]::placeholder {
  color: #666;
}

.upload-modal input[type="text"]:focus,
.upload-modal input[type="url"]:focus {
  border-color: #1c62b9;
}

.upload-modal .file-name {
  color: #aaa;
  font-size: 0.85rem;
  margin-bottom: 16px;
  word-break: break-all;
}

.upload-modal .submit-btn {
  width: 100%;
  padding: 12px;
  background: #cc0000;
  color: #fff;
  border: 0;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.upload-modal .submit-btn:hover {
  background: #e60000;
}

.progress-bar {
  position: relative;
  margin-bottom: 16px;
  background: #222;
  border-radius: 8px;
  height: 28px;
  overflow: hidden;
}

.progress-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: #cc0000;
  border-radius: 8px;
  transition: width 0.2s;
}

.progress-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  color: #fff;
  font-weight: 500;
}

.upload-modal .submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── Video grid ────────────────────────────────────────── */
.search-info {
  color: #aaa;
  margin-bottom: 16px;
  font-size: 0.9rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 36px 24px;
}

.card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
}

.card-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  background: #1a1a1a;
}

.card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-thumb--empty {
  background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
}

.card-body {
  padding: 16px 0 12px;
  display: flex;
  gap: 14px;
}

.card-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #7c4dff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  color: #fff;
  flex-shrink: 0;
  margin-top: 4px;
  overflow: hidden;
}

.card-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

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

.card-title {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: #f1f1f1;
  margin-bottom: 4px;
}

.card-meta {
  font-size: 0.8rem;
  color: #aaa;
  line-height: 1.4;
}

.empty {
  color: #555;
  font-size: 0.9rem;
  grid-column: 1 / -1;
  padding: 60px 0;
  text-align: center;
}

/* ── Video page ────────────────────────────────────────── */
.video-page {
  display: flex;
  gap: 24px;
  max-width: 1400px;
  margin: 0 auto;
  overflow-x: hidden;
  padding: 24px 0;
}

.video-primary {
  flex: 1;
  min-width: 0;
}

.video-container {
  margin-bottom: 24px;
}

.video-container video {
  width: 100%;
  border-radius: 12px;
  background: #000;
  display: block;
  aspect-ratio: 16 / 9;
}

.video-meta {
  padding: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  overflow-x: hidden;
}

.video-title {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 4px;
}

.video-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.btn-delete {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: #2a2a2a;
  color: #ff6b6b;
  border: 1px solid #444;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.15s;
}

.btn-delete:hover {
  background: #3a1a1a;
  border-color: #ff6b6b;
}

/* ── Login page ────────────────────────────────────────── */
.login-page {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  background: #0f0f0f;
}

.login-card {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 16px;
  padding: 48px 40px;
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 32px;
}

.login-logo span {
  font-size: 1.6rem;
  font-weight: 600;
  color: #fff;
  letter-spacing: -0.5px;
}

.login-logo sup {
  font-size: 0.6rem;
  color: #aaa;
  font-weight: 400;
  vertical-align: super;
}

.login-card h1 {
  font-size: 1.1rem;
  margin-bottom: 24px;
  font-weight: 500;
  color: #ccc;
}

.login-card form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-card input {
  padding: 14px 16px;
  background: #121212;
  border: 1px solid #333;
  border-radius: 10px;
  color: #fff;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.15s;
}

.login-card input:focus {
  border-color: #1c62b9;
}

.login-card button {
  padding: 14px;
  background: #cc0000;
  color: #fff;
  border: 0;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 4px;
  transition: background 0.15s;
}

.login-card button:hover {
  background: #e60000;
}

.error-msg {
  color: #ff6b6b;
  font-size: 0.9rem;
  margin-bottom: 12px;
  background: #2a1a1a;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid #4a1a1a;
}

/* ── Tabs ──────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  border-bottom: 1px solid #333;
}

.tab {
  padding: 10px 20px;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  color: #aaa;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.15s;
}

.tab.active {
  color: #fff;
  border-bottom-color: #cc0000;
}

.tab-content { display: none; }
.tab-content.active { display: block; }

.hint {
  color: #666;
  font-size: 0.8rem;
  margin-top: -8px;
  margin-bottom: 16px;
}

/* ── Spinner ───────────────────────────────────────────── */
.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid #333;
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.card-duration {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.3px;
}

.storage-indicator {
  font-size: 0.75rem;
  color: #aaa;
  padding: 4px 10px;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 12px;
  white-space: nowrap;
}

.card-thumb--pending,
.card-thumb--failed {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1a1a1a;
}

.video-placeholder {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #1a1a1a;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: #888;
  font-size: 0.95rem;
}

.error-detail {
  font-size: 0.8rem;
  color: #666;
  max-width: 400px;
  text-align: center;
  word-break: break-all;
}

/* ── Action Bar (Like / Comment / Save) ───────────────── */
.action-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 0;
  border-bottom: 1px solid #2a2a2a;
  margin-bottom: 24px;
}

.btn-like {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: #2a2a2a;
  color: #f1f1f1;
  border: 0;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.15s;
}

.btn-like:hover {
  background: #3a3a3a;
}

.btn-like .like-icon-filled {
  display: none;
}

.btn-like .like-icon-outline {
  display: block;
}

.btn-like.liked {
  color: #cc0000;
  background: #3a1a1a;
}

.btn-like.liked .like-icon-filled {
  display: block;
}

.btn-like.liked .like-icon-outline {
  display: none;
}

.btn-like.liked:hover {
  background: #4a1a1a;
}

.like-count {
  font-variant-numeric: tabular-nums;
}

.btn-comment-count {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: transparent;
  color: #f1f1f1;
  border: 0;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: background 0.15s;
}

.btn-comment-count:hover {
  background: #2a2a2a;
}

.btn-save {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: transparent;
  color: #f1f1f1;
  border: 0;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: background 0.15s;
  margin-left: auto;
}

.btn-save:hover {
  background: #2a2a2a;
}

/* ── Comments Section ─────────────────────────────────── */
.comments-section {
  margin-top: 8px;
}

.comments-heading {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 24px;
  color: #f1f1f1;
}

.comment-form {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}

.comment-form-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #7c4dff;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  flex-shrink: 0;
}

.comment-form-input {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.comment-form-input textarea {
  width: 100%;
  padding: 12px 0;
  background: transparent;
  border: none;
  border-bottom: 2px solid #333;
  color: #f1f1f1;
  font-size: 0.9rem;
  outline: none;
  resize: none;
  font-family: inherit;
  min-height: 24px;
  transition: border-color 0.15s;
}

.comment-form-input textarea:focus {
  border-bottom-color: #1c62b9;
}

.comment-form-input textarea::placeholder {
  color: #666;
}

.comment-submit-btn {
  align-self: flex-end;
  padding: 8px 20px;
  background: #cc0000;
  color: #fff;
  border: 0;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  transition: background 0.15s;
}

.comment-submit-btn:hover {
  background: #e60000;
}

.comments-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.comment {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  align-items: flex-start;
}

.comment-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #7c4dff;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  flex-shrink: 0;
}

.comment-body {
  flex: 1;
  min-width: 0;
}

.comment-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.comment-user {
  font-size: 0.85rem;
  font-weight: 600;
  color: #f1f1f1;
}

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

.comment-text {
  font-size: 0.9rem;
  color: #e0e0e0;
  line-height: 1.5;
  word-wrap: break-word;
}

.comment-delete {
  background: transparent;
  border: 0;
  color: #666;
  cursor: pointer;
  padding: 4px;
  flex-shrink: 0;
  opacity: 0;
  transition: all 0.15s;
  border-radius: 50%;
  line-height: 0;
}

.comment:hover .comment-delete {
  opacity: 1;
}

.comment-delete:hover {
  color: #ff6b6b;
  background: #2a1a1a;
}

/* ── Playlist Picker Modal ────────────────────────────── */
.playlist-picker-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 250;
  align-items: center;
  justify-content: center;
}

.playlist-picker-modal {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 16px;
  width: 100%;
  max-width: 420px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.playlist-picker-header {
  display: flex;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid #2a2a2a;
}

.playlist-picker-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: #f1f1f1;
}

.playlist-picker-header .close-btn {
  margin-left: auto;
  background: none;
  border: 0;
  color: #aaa;
  font-size: 1.4rem;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

.playlist-picker-header .close-btn:hover {
  color: #fff;
}

.playlist-picker-body {
  padding: 12px 0;
  overflow-y: auto;
  flex: 1;
}

.playlist-picker-loading,
.playlist-picker-empty {
  padding: 24px;
  text-align: center;
  color: #888;
  font-size: 0.9rem;
}

.playlist-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  cursor: pointer;
  transition: background 0.1s;
}

.playlist-item:hover {
  background: #2a2a2a;
}

.playlist-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #cc0000;
  cursor: pointer;
  flex-shrink: 0;
}

.playlist-item-name {
  font-size: 0.9rem;
  color: #f1f1f1;
  font-weight: 500;
}

.playlist-picker-footer {
  display: flex;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid #2a2a2a;
}

.playlist-picker-footer input[type="text"] {
  flex: 1;
  padding: 10px 14px;
  background: #121212;
  border: 1px solid #333;
  border-radius: 8px;
  color: #fff;
  font-size: 0.9rem;
  outline: none;
}

.playlist-picker-footer input[type="text"]:focus {
  border-color: #1c62b9;
}

.playlist-picker-footer input[type="text"]::placeholder {
  color: #666;
}

.playlist-picker-footer .submit-btn {
  padding: 10px 20px;
  background: #cc0000;
  color: #fff;
  border: 0;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}

.playlist-picker-footer .submit-btn:hover {
  background: #e60000;
}

/* ── Playlist Cards ────────────────────────────────────── */
.playlists-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 0;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 24px;
  color: #f1f1f1;
}

.create-playlist-form {
  display: flex;
  gap: 12px;
  margin-bottom: 32px;
  max-width: 500px;
}

.create-playlist-form input[type="text"] {
  flex: 1;
  padding: 12px 16px;
  background: #121212;
  border: 1px solid #333;
  border-radius: 8px;
  color: #fff;
  font-size: 0.95rem;
  outline: none;
}

.create-playlist-form input[type="text"]:focus {
  border-color: #1c62b9;
}

.create-playlist-form input[type="text"]::placeholder {
  color: #666;
}

.create-playlist-form .submit-btn {
  padding: 12px 24px;
  background: #cc0000;
  color: #fff;
  border: 0;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}

.create-playlist-form .submit-btn:hover {
  background: #e60000;
}

.playlist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.playlist-card {
  display: flex;
  flex-direction: column;
  position: relative;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.15s;
}

.playlist-card:hover {
  border-color: #444;
}

.playlist-card-link {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.playlist-card-thumb {
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
  overflow: hidden;
}

.playlist-card-body {
  padding: 16px;
}

.playlist-card-title {
  font-size: 1rem;
  font-weight: 600;
  color: #f1f1f1;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.playlist-card-meta {
  font-size: 0.8rem;
  color: #888;
}

.playlist-card-delete {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.6);
  border: 0;
  color: #aaa;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all 0.15s;
}

.playlist-card:hover .playlist-card-delete {
  opacity: 1;
}

.playlist-card-delete:hover {
  background: rgba(200, 0, 0, 0.6);
  color: #fff;
}

/* ── Playlist Detail Page ─────────────────────────────── */
.playlist-detail-page {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 0;
}

.playlist-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 32px;
}

.playlist-detail-info {
  flex: 1;
}

.playlist-detail-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: #f1f1f1;
  margin-bottom: 8px;
}

.playlist-detail-meta {
  font-size: 0.9rem;
  color: #888;
}

.card-remove-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.6);
  border: 0;
  color: #aaa;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all 0.15s;
  z-index: 10;
}

.card:hover .card-remove-btn {
  opacity: 1;
}

.card-remove-btn:hover {
  background: rgba(200, 0, 0, 0.6);
  color: #fff;
}

/* ── Mobile responsiveness ───────────────────────────── */
@media (max-width: 768px) {
  .topbar { padding: 0 8px; }
  .topbar-inner { gap: 6px; }
  .logo sup { display: none; }
  .search-form { max-width: none; }
  .search-form input { font-size: 0.85rem; padding: 0 10px; }
  .search-form .search-btn { width: 44px; }
  .storage-indicator { display: none; }
  .btn-upload { padding: 8px 10px; }
  .btn-upload span { display: none; }
  .btn-upload svg { margin: 0; }
  main { padding: 8px 12px; overflow-x: hidden; }
  .grid { grid-template-columns: 1fr; gap: 20px 0; }
  .card-title { font-size: 0.85rem; }
  .card-meta { font-size: 0.7rem; }
  .card-avatar { width: 28px; height: 28px; font-size: 0.7rem; }
  .card-body { gap: 8px; }
  .card-duration { font-size: 0.65rem; bottom: 4px; right: 4px; }
  .upload-modal { margin: 12px; padding: 20px; }
  .video-title { font-size: 1rem; word-break: break-word; }
  .video-page { flex-direction: column; }
  .video-container { max-width: 100%; }
  .video-container video { border-radius: 8px; }
  .video-meta { flex-direction: column; align-items: flex-start; }
  .video-actions { width: 100%; }
  .btn-delete { width: 100%; justify-content: center; }
  .tabs .tab { font-size: 0.8rem; padding: 8px 12px; }
  .action-bar { flex-wrap: wrap; }
  .btn-save { margin-left: 0; }
  .playlist-picker-modal { max-width: 90vw; }
  .playlist-grid { grid-template-columns: 1fr; }
  .create-playlist-form { flex-direction: column; max-width: none; }
  .playlist-detail-header { flex-direction: column; }
  .playlists-page { padding: 12px 0; }
  .playlist-detail-page { padding: 12px 0; }
}

@media (max-width: 480px) {
  .topbar-inner { gap: 4px; }
  .logo { font-size: 1rem; margin-right: 4px; }
  .logo svg { width: 22px; height: 16px; }
  .search-form input { font-size: 0.8rem; padding: 0 8px; height: 34px; }
  .search-form .search-btn { width: 36px; height: 34px; }
  .btn-upload { padding: 6px 8px; }
  .avatar { width: 28px; height: 28px; font-size: 0.75rem; }
  .avatar-dropdown { right: -8px; }
  .grid { grid-template-columns: 1fr; gap: 8px 0; }
  .card-thumb { border-radius: 8px; }
  .card-title { -webkit-line-clamp: 1; font-size: 0.8rem; }
  main { padding: 6px 8px; }
  .upload-modal { padding: 16px; }
  .upload-modal .upload-area { padding: 24px 16px; }
  .upload-modal input[type="text"],
  .upload-modal input[type="url"] { font-size: 0.85rem; padding: 10px 12px; }
  .upload-modal h2 { font-size: 1rem; }
  .tabs .tab { font-size: 0.75rem; padding: 6px 10px; }
}

/* ── Playlist strip on landing page ──────────────────── */
.playlist-strip {
  margin-bottom: 32px;
}

.playlist-strip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.playlist-strip-header h2 {
  font-size: 1.2rem;
  font-weight: 600;
}

.playlist-strip-all {
  font-size: 0.85rem;
  color: #aaa;
  text-decoration: none;
}

.playlist-strip-all:hover {
  color: #fff;
}

.playlist-strip-scroll {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: thin;
  scrollbar-color: #444 transparent;
}

.playlist-strip-scroll::-webkit-scrollbar {
  height: 6px;
}

.playlist-strip-scroll::-webkit-scrollbar-thumb {
  background: #444;
  border-radius: 3px;
}

.playlist-strip-card {
  flex: 0 0 180px;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  border-radius: 12px;
  overflow: hidden;
  background: #1a1a1a;
  transition: background 0.15s;
}

.playlist-strip-card:hover {
  background: #2a2a2a;
}

.playlist-strip-thumb {
  aspect-ratio: 16 / 9;
  background: #222;
  overflow: hidden;
}

.playlist-strip-info {
  padding: 10px 12px;
}

.playlist-strip-name {
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 2px;
}

.playlist-strip-count {
  font-size: 0.75rem;
  color: #aaa;
}

@media (max-width: 768px) {
  .playlist-strip-card {
    flex: 0 0 140px;
  }
}


/* ── Confirm / Alert Modal ──────────────────────────── */
.confirm-overlay,
.alert-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 500;
  align-items: center;
  justify-content: center;
}

.confirm-modal,
.alert-modal {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 16px;
  padding: 28px 32px;
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.confirm-message,
.alert-message {
  font-size: 1rem;
  color: #f1f1f1;
  margin-bottom: 24px;
  line-height: 1.5;
}

.confirm-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.confirm-cancel,
.confirm-ok,
.alert-ok {
  padding: 10px 24px;
  border: 0;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.confirm-cancel {
  background: #2a2a2a;
  color: #f1f1f1;
}

.confirm-cancel:hover {
  background: #3a3a3a;
}

.confirm-ok,
.alert-ok {
  background: #cc0000;
  color: #fff;
}

.confirm-ok:hover,
.alert-ok:hover {
  background: #e60000;
}

/* ── Playlist card thumbnail image ──────────────────── */
.thumb-icon {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.playlist-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.playlist-strip-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.playlist-detail-thumb {
  width: 200px;
  height: 112px;
  border-radius: 12px;
  overflow: hidden;
  flex-shrink: 0;
  background: #1a1a1a;
}

.playlist-detail-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}