body {
  min-height: 100vh;
}

.home {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 24px 64px;
}

.home-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hero {
  margin: 36px 0 44px;
  max-width: 760px;
}

.hero h1 {
  margin: 0 0 12px;
  font-size: 34px;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.hero p {
  margin: 0;
  color: #c9c9d4;
  font-size: 16px;
  line-height: 1.6;
}

.hero strong {
  color: var(--text);
}

.steps {
  display: grid;
  gap: 10px;
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
}

.steps li {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #c9c9d4;
}

.step-number {
  display: grid;
  place-items: center;
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: #e9d5ff;
  font-weight: 700;
  font-size: 13px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  margin-top: 26px;
}

.primary-link {
  padding: 12px 22px;
  border-radius: 999px;
  background: linear-gradient(90deg, #a855f7, #818cf8);
  color: #fff;
  font-weight: 650;
  text-decoration: none;
}

.primary-link:hover {
  filter: brightness(1.08);
}

.text-link {
  color: #c084fc;
  font-size: 14px;
}

.library-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.library-bar h2 {
  margin: 0;
  font-size: 20px;
}

.library-bar input {
  width: min(320px, 100%);
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
}

.empty-library {
  max-width: 560px;
  margin: 0;
  padding: 22px 24px;
  border: 1px dashed var(--border-strong);
  border-radius: 14px;
  color: var(--muted);
  line-height: 1.55;
}

.song-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 26px 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.song-grid li {
  position: relative;
  display: flex;
  flex-direction: column;
}

.song-grid li > .song-card { flex: 1; }

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

.thumb {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 12px;
  background: #121216;
  transition: border-radius 0.15s ease;
}

.thumb.file-thumb > span[aria-hidden="true"] {
  position: absolute;
  top: 12px;
  left: 12px;
  line-height: 1;
}

.song-card:hover .thumb {
  border-radius: 4px;
}

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

.duration {
  position: absolute;
  right: 6px;
  bottom: 6px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.8);
  font-size: 12px;
  font-weight: 600;
}

.song-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-weight: 600;
  line-height: 1.35;
}

.song-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
}

.tag.setting {
  background: var(--accent-soft);
  border-color: transparent;
  color: #e9d5ff;
}

.song-forget {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 18px;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.song-grid li:hover .song-forget,
.song-forget:focus-visible {
  opacity: 1;
}

.song-forget:hover {
  background: var(--error);
}

.hero .drop-hint { margin-top: 16px; font-size: 14px; color: var(--muted); }

.library-group + .library-group { margin-top: 32px; }
.library-group h3 { color: var(--muted); font-size: 16px; margin: 0 0 18px; }

 .library-heading { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.library-import, .song-export { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--card); color: var(--text); font-weight: 600; transition: background .15s, border-color .15s; }
.library-import { padding: 7px 13px; font-size: 13px; }
.song-export { margin: 12px 0 0; padding: 7px 12px; font-size: 12px; }
.library-import span, .song-export span { color: #c084fc; font-size: 16px; line-height: 1; }
.library-import:hover, .song-export:hover { background: var(--card-hover); border-color: #71717a; }
.library-bar > input[type="search"] { margin-left: auto; }
.library-bar input[hidden] { display: none; }

.library-section > .banner,
.library-section > .problem { margin-bottom: 20px; }
.library-section { --library-section-gap: 28px; }
.library-section > .library-transfer-hint { margin: 0 0 var(--library-section-gap); line-height: 1.6; }
.library-section > .library-summary { margin: var(--library-section-gap) 0; }


.forget-dialog { width: min(440px, calc(100vw - 40px)); box-sizing: border-box; padding: 28px; border: 1px solid var(--border); border-radius: 20px; background: var(--panel, #202027); color: var(--text); box-shadow: 0 24px 80px #0009; }
.forget-dialog::backdrop { background: #0009; backdrop-filter: blur(4px); }
.forget-dialog h2 { margin: 0 0 12px; font-size: 23px; }
.forget-dialog p { margin: 10px 0; line-height: 1.5; color: var(--muted); }
.forget-dialog .forget-dialog-song { color: var(--text); font-weight: 600; overflow-wrap: anywhere; }
.home button { -webkit-appearance: none; appearance: none; }
/* Shared by create/edit, export, delete-folder and delete-song dialogs. */
.forget-dialog button {
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
  min-height: 40px;
  margin: 0;
  padding: 9px 16px;
  border: 1px solid #41414c;
  border-radius: 8px;
  background: #292931;
  color: var(--text);
  box-shadow: none;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  text-align: center;
  transition: background .15s, border-color .15s;
}
.forget-dialog button:hover:not(:disabled) { background: #33333d; border-color: #626270; }
.forget-dialog button:focus-visible { outline: none; border-color: #a1a1aa; }
.forget-dialog button:active:not(:disabled) { background: #22222a; }
.forget-dialog button:disabled { opacity: 1; background: #24242c; border-color: #34343e; color: #777783; cursor: default; }
.forget-dialog button.dialog-primary { background: #e2e2ea; border-color: #e2e2ea; color: #202027; }
.forget-dialog button.dialog-primary:hover:not(:disabled) { background: #f2f2f7; border-color: #f2f2f7; }
.forget-dialog button.dialog-primary:active:not(:disabled) { background: #c9c9d4; border-color: #c9c9d4; }
.forget-dialog button.dialog-primary:disabled { background: #34343f; border-color: #34343f; color: #858591; }
.forget-dialog button.forget-dialog-confirm { background: #a83e4c; border-color: #a83e4c; color: #fff; }
.forget-dialog button.forget-dialog-confirm:hover:not(:disabled) { background: #ba4857; border-color: #ba4857; }
.forget-dialog button.forget-dialog-confirm:disabled { background: #50303a; border-color: #50303a; color: #b68f98; }
.forget-dialog-actions, .library-dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 10px; margin-top: 24px; }
.library-dialog h2 { margin-top: 0; }
.library-dialog form { margin-top: 20px; }

.forget-dialog-thumbnail { display: block; width: 100%; max-height: 180px; object-fit: cover; border-radius: 12px; margin-top: 16px; }
.forget-dialog-video { display: inline-block; color: var(--accent); font-size: 13px; margin-bottom: 8px; }

.library-import:disabled, .song-export:disabled { opacity: .45; cursor: default; }

.folder-navigation { display: flex; align-items: end; flex-wrap: wrap; gap: 10px; margin: 0 0 var(--library-section-gap); }
.folder-navigation label, .song-folder, .library-dialog label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 12px; }
.folder-navigation select, .song-folder select, .library-dialog select, .library-dialog input { padding: 9px 12px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--card); color: var(--text); font: inherit; min-width: 0; max-width: 100%; }
.folder-navigation label { min-width: min(280px, 100%); max-width: 100%; }
.folder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; list-style: none; padding: 0; margin: 0 0 var(--library-section-gap); }
.folder-grid button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 18px; text-align: left; border: 1px solid var(--border-strong); border-radius: 12px; background: var(--card); color: var(--text); overflow-wrap: anywhere; }
.folder-grid button:hover { border-color: #71717a; background: var(--card-hover); }
.folder-grid svg { flex: none; color: #b8bbc5; }
.folder-grid span { min-width: 0; }
.song-folder { margin-top: 14px; }
.song-export { align-self: flex-start; }
.tag.missing { background: #3b2a14; border-color: transparent; color: #fcd34d; }
.missing-files { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.library-dialog form, .folder-dialog-options { display: flex; flex-direction: column; gap: 16px; }
.song-grid li:focus-within .song-forget { opacity: 1; }
@media (hover: none) { .song-forget { opacity: 1; } }

/* Keep folder form controls rectangular and focus feedback on the control itself. */
.library-dialog label:focus-within { outline: none; box-shadow: none; }
.library-dialog input, .library-dialog select { border-radius: 3px; box-shadow: none; }
.library-dialog input:focus, .library-dialog select:focus { outline: none; border-color: #a1a1aa; box-shadow: none; }
.library-dialog input:focus-visible, .library-dialog select:focus-visible { outline: none; border-color: #a1a1aa; }
.song-location { color: var(--muted); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }

.folder-navigation label:focus-within, .song-folder:focus-within { outline: none; box-shadow: none; }
.folder-navigation select:focus, .song-folder select:focus { outline: none; box-shadow: none; border-color: #a1a1aa; }

.song-card[draggable="true"], .folder-grid button[draggable="true"] { cursor: grab; }
.drag-source { opacity: .45; }
.home .drop-ready { border-color: #b7c7b0; background: #2b392e; box-shadow: inset 0 0 0 1px #b7c7b0; }

.library-dialog .folder-name-error { margin: -8px 0 0; color: var(--error, #ef6666); font-size: 13px; line-height: 1.5; }
.library-dialog input[aria-invalid="true"] { border-color: var(--error, #ef6666); }

.library-parent-drop { display: none; align-items: center; justify-content: center; gap: 10px; box-sizing: border-box; width: 100%; min-height: 64px; margin: 0 0 var(--library-section-gap); padding: 16px; border: 1px dashed #71717a; border-radius: 8px; background: transparent; color: var(--muted); font-size: 14px; line-height: 1.5; text-align: center; overflow-wrap: anywhere; }
.library-parent-drop svg { flex: none; }
.home .library-parent-drop.drop-ready { box-shadow: none; color: var(--text); }

.home[data-library-dragging="true"] .library-parent-drop { display: flex; }

.home { overflow-anchor: none; }
/* Shared by the extension Home and the website Library. */
.cloud-backup { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 24px; box-sizing: border-box; width: 100%; padding: 16px 20px; margin: 0 0 24px; border: 1px solid var(--border); border-radius: 12px; background: var(--card); }
.cloud-backup-summary { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1 1 260px; }
.cloud-backup-copy { min-width: 0; }
.cloud-backup-help { position: relative; display: inline-block; margin-left: 8px; vertical-align: middle; }
.cloud-backup-help-button { display: grid; place-items: center; width: 20px; height: 20px; padding: 0; border: 1px solid var(--border-strong); border-radius: 50%; background: transparent; color: var(--muted); font-size: 11px; cursor: help; }
.cloud-backup-tooltip { display: none; position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; width: 280px; max-width: calc(100vw - 40px); padding: 12px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--panel, #202027); color: var(--text); font-size: 12px; font-weight: 400; line-height: 1.5; box-shadow: 0 6px 20px #0005; }
.cloud-backup-help:hover .cloud-backup-tooltip, .cloud-backup-help:focus-within .cloud-backup-tooltip { display: block; }
.cloud-backup-title { display: block; color: var(--text); font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.cloud-backup-detail { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.cloud-backup-avatar { display: grid; place-items: center; flex: 0 0 36px; height: 36px; border-radius: 50%; background: var(--accent-soft); color: var(--text); font-size: 14px; font-weight: 600; }
.cloud-backup-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.cloud-backup-actions .library-import { white-space: nowrap; }
.cloud-backup-toggle { position: relative; display: inline-flex; align-items: center; gap: 9px; font-size: 12px; cursor: pointer; white-space: nowrap; }
.cloud-backup-toggle input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.cloud-backup-switch { position: relative; flex: 0 0 36px; width: 36px; height: 22px; border: 1px solid var(--border-strong); border-radius: 999px; box-sizing: border-box; background: var(--bg); transition: background .15s, border-color .15s; }
.cloud-backup-switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--muted); transition: transform .15s, background .15s; }
.cloud-backup-toggle input:checked + .cloud-backup-switch { background: var(--accent); border-color: var(--accent); }
.cloud-backup-toggle input:checked + .cloud-backup-switch::after { transform: translateX(14px); background: #fff; }
.cloud-backup-toggle input:focus-visible + .cloud-backup-switch { outline: 2px solid var(--accent); outline-offset: 3px; }
.cloud-backup-toggle input:disabled + .cloud-backup-switch { opacity: .45; }
.cloud-backup-loading { display: grid; gap: 8px; padding: 4px 0; }
.cloud-backup-loading span, .cloud-backup-loading-action { display: block; border-radius: 999px; background: var(--border); }
.cloud-backup-loading span:first-child { width: 180px; height: 13px; }
.cloud-backup-loading span:last-child { width: min(300px, 50vw); height: 11px; opacity: .6; }
.cloud-backup-loading-action { width: 160px; height: 32px; opacity: .6; }
.cloud-backup .google-signin-button { flex-shrink: 0; white-space: nowrap; }
.cloud-backup .google-signin-button img { width: 18px; height: 18px; object-fit: contain; flex-shrink: 0; }
.cloud-backup button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.cloud-backup > .backup-success, .cloud-backup > .backup-info, .cloud-backup > .problem { flex-basis: 100%; margin: 0; font-size: 12px; }
.backup-info { padding: 9px 12px; border-radius: 10px; border: 1px solid var(--border); color: var(--muted); }
.backup-success { padding: 9px 12px; border-radius: 10px; background: rgb(74 222 128 / 9%); border: 1px solid rgb(74 222 128 / 28%); color: #86efac; }

.audio-storage { align-items: flex-start; }
.audio-storage h3 { margin: 0; }
.audio-storage-form { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; }
.audio-storage-limit { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 12px; }
.audio-storage-limit input { width: 84px; box-sizing: border-box; padding: 7px 9px; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--bg); color: var(--text); font: inherit; }
.audio-storage-limit input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.audio-storage-explanation { flex-basis: 100%; color: var(--muted); font-size: 12px; line-height: 1.5; }
.audio-storage-explanation p { margin: 0 0 6px; }

.song-removal-choices { display: grid; gap: 10px; margin-top: 24px; }

.folder-info { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.song-card[data-audio-state="saved"] .thumb { outline: 1px solid #34685c; }

.folder-song-count { color: var(--muted); font-size: 11px; font-weight: 400; line-height: 1.4; }
