Files
music-platform/public/css/style.css
hz4th_coder 595670b6ce feat: 音乐展示平台 v1.0.0
- 响应式设计,支持桌面端和手机端自适应
- 首页展示轮播图、推荐歌单、热门歌曲、新碟上架、热门歌手
- 歌曲/歌手/专辑/歌单详情页
- 底部播放器:播放/暂停、上下首、进度拖动、音量控制
- 歌词同步滚动显示
- 搜索功能
- 后台管理 /admin
- JSON文件存储
2026-07-07 23:57:31 +08:00

1097 lines
18 KiB
CSS

/* ============ CSS 变量 & 基础 ============ */
:root {
--primary: #e74c3c;
--primary-dark: #c0392b;
--bg-dark: #1a1a2e;
--bg-card: #16213e;
--bg-surface: #0f3460;
--text-primary: #ffffff;
--text-secondary: #a0a0b0;
--text-muted: #6c6c80;
--border-color: #2a2a4a;
--player-height: 80px;
--header-height: 60px;
--sidebar-width: 240px;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
background: var(--bg-dark);
color: var(--text-primary);
min-height: 100vh;
overflow-x: hidden;
}
a {
color: inherit;
text-decoration: none;
}
/* ============ 滚动条 ============ */
::-webkit-scrollbar {
width: 6px;
}
::-webkit-scrollbar-track {
background: transparent;
}
::-webkit-scrollbar-thumb {
background: var(--text-muted);
border-radius: 3px;
}
/* ============ 头部导航 ============ */
.header {
position: fixed;
top: 0;
left: 0;
right: 0;
height: var(--header-height);
background: rgba(26, 26, 46, 0.95);
backdrop-filter: blur(10px);
display: flex;
align-items: center;
padding: 0 20px;
z-index: 1000;
border-bottom: 1px solid var(--border-color);
}
.header-logo {
font-size: 22px;
font-weight: bold;
color: var(--primary);
margin-right: 30px;
cursor: pointer;
}
.header-logo span {
color: var(--text-primary);
}
.header-nav {
display: flex;
gap: 20px;
}
.header-nav a {
color: var(--text-secondary);
font-size: 14px;
padding: 8px 0;
transition: color 0.2s;
}
.header-nav a:hover, .header-nav a.active {
color: var(--text-primary);
}
.header-search {
margin-left: auto;
position: relative;
}
.header-search input {
background: var(--bg-surface);
border: 1px solid var(--border-color);
border-radius: 20px;
padding: 8px 16px 8px 36px;
color: var(--text-primary);
font-size: 14px;
width: 200px;
outline: none;
transition: width 0.3s, border-color 0.3s;
}
.header-search input:focus {
width: 280px;
border-color: var(--primary);
}
.header-search .search-icon {
position: absolute;
left: 12px;
top: 50%;
transform: translateY(-50%);
color: var(--text-muted);
}
/* ============ 主内容区 ============ */
.main-content {
margin-top: var(--header-height);
margin-bottom: var(--player-height);
padding: 20px;
min-height: calc(100vh - var(--header-height) - var(--player-height));
}
/* ============ 轮播图 ============ */
.banner-section {
position: relative;
border-radius: 12px;
overflow: hidden;
margin-bottom: 30px;
height: 280px;
}
.banner-slide {
width: 100%;
height: 100%;
position: relative;
display: none;
}
.banner-slide.active {
display: block;
animation: fadeIn 0.5s;
}
@keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
.banner-slide img {
width: 100%;
height: 100%;
object-fit: cover;
}
.banner-overlay {
position: absolute;
bottom: 0;
left: 0;
right: 0;
padding: 30px 20px 20px;
background: linear-gradient(transparent, rgba(0,0,0,0.8));
}
.banner-overlay h2 {
font-size: 24px;
margin-bottom: 8px;
}
.banner-dots {
position: absolute;
bottom: 15px;
right: 20px;
display: flex;
gap: 8px;
}
.banner-dots span {
width: 8px;
height: 8px;
border-radius: 50%;
background: rgba(255,255,255,0.5);
cursor: pointer;
transition: background 0.3s;
}
.banner-dots span.active {
background: var(--primary);
width: 24px;
border-radius: 4px;
}
/* ============ 区块标题 ============ */
.section-title {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 16px;
}
.section-title h3 {
font-size: 20px;
font-weight: 600;
}
.section-title .more-link {
color: var(--text-muted);
font-size: 13px;
cursor: pointer;
transition: color 0.2s;
}
.section-title .more-link:hover {
color: var(--primary);
}
/* ============ 歌单卡片网格 ============ */
.playlist-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
gap: 20px;
margin-bottom: 40px;
}
.playlist-card {
cursor: pointer;
transition: transform 0.2s;
}
.playlist-card:hover {
transform: translateY(-4px);
}
.playlist-card .cover {
position: relative;
width: 100%;
padding-bottom: 100%;
border-radius: 8px;
overflow: hidden;
background: var(--bg-card);
}
.playlist-card .cover img {
position: absolute;
width: 100%;
height: 100%;
object-fit: cover;
}
.playlist-card .cover .play-count {
position: absolute;
top: 6px;
right: 8px;
font-size: 11px;
color: rgba(255,255,255,0.9);
display: flex;
align-items: center;
gap: 3px;
}
.playlist-card .cover .play-btn {
position: absolute;
bottom: 8px;
right: 8px;
width: 36px;
height: 36px;
border-radius: 50%;
background: var(--primary);
display: flex;
align-items: center;
justify-content: center;
opacity: 0;
transform: translateY(8px);
transition: all 0.2s;
}
.playlist-card:hover .play-btn {
opacity: 1;
transform: translateY(0);
}
.playlist-card .title {
margin-top: 8px;
font-size: 13px;
line-height: 1.4;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
}
/* ============ 歌曲列表 ============ */
.song-list {
margin-bottom: 40px;
}
.song-item {
display: flex;
align-items: center;
padding: 10px 16px;
border-radius: 8px;
cursor: pointer;
transition: background 0.2s;
}
.song-item:hover {
background: var(--bg-card);
}
.song-item.playing {
background: rgba(231, 76, 60, 0.1);
}
.song-item .index {
width: 30px;
text-align: center;
color: var(--text-muted);
font-size: 14px;
}
.song-item .cover {
width: 46px;
height: 46px;
border-radius: 6px;
overflow: hidden;
margin: 0 12px;
background: var(--bg-surface);
flex-shrink: 0;
}
.song-item .cover img {
width: 100%;
height: 100%;
object-fit: cover;
}
.song-item .info {
flex: 1;
min-width: 0;
}
.song-item .info .name {
font-size: 14px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.song-item .info .artist {
font-size: 12px;
color: var(--text-secondary);
margin-top: 4px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.song-item .duration {
color: var(--text-muted);
font-size: 12px;
margin-left: 12px;
}
.song-item .actions {
margin-left: 12px;
opacity: 0;
transition: opacity 0.2s;
}
.song-item:hover .actions {
opacity: 1;
}
/* ============ 歌手卡片 ============ */
.artist-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
gap: 20px;
margin-bottom: 40px;
}
.artist-card {
text-align: center;
cursor: pointer;
transition: transform 0.2s;
}
.artist-card:hover {
transform: translateY(-4px);
}
.artist-card .avatar {
width: 120px;
height: 120px;
border-radius: 50%;
overflow: hidden;
margin: 0 auto;
background: var(--bg-card);
}
.artist-card .avatar img {
width: 100%;
height: 100%;
object-fit: cover;
}
.artist-card .name {
margin-top: 10px;
font-size: 14px;
}
/* ============ 专辑卡片 ============ */
.album-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
gap: 20px;
margin-bottom: 40px;
}
.album-card {
cursor: pointer;
transition: transform 0.2s;
}
.album-card:hover {
transform: translateY(-4px);
}
.album-card .cover {
width: 100%;
padding-bottom: 100%;
position: relative;
border-radius: 8px;
overflow: hidden;
background: var(--bg-card);
}
.album-card .cover img {
position: absolute;
width: 100%;
height: 100%;
object-fit: cover;
}
.album-card .title {
margin-top: 8px;
font-size: 14px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.album-card .artist {
font-size: 12px;
color: var(--text-secondary);
margin-top: 4px;
}
/* ============ 底部播放器 ============ */
.player {
position: fixed;
bottom: 0;
left: 0;
right: 0;
height: var(--player-height);
background: rgba(15, 15, 30, 0.98);
backdrop-filter: blur(20px);
border-top: 1px solid var(--border-color);
display: flex;
align-items: center;
padding: 0 16px;
z-index: 1001;
}
.player-song {
display: flex;
align-items: center;
width: 240px;
min-width: 200px;
}
.player-song .cover {
width: 56px;
height: 56px;
border-radius: 6px;
overflow: hidden;
margin-right: 12px;
background: var(--bg-card);
flex-shrink: 0;
}
.player-song .cover img {
width: 100%;
height: 100%;
object-fit: cover;
}
.player-song .info {
min-width: 0;
}
.player-song .info .name {
font-size: 14px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
max-width: 160px;
}
.player-song .info .artist {
font-size: 12px;
color: var(--text-secondary);
margin-top: 4px;
}
.player-controls {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
padding: 0 20px;
}
.player-buttons {
display: flex;
align-items: center;
gap: 20px;
margin-bottom: 8px;
}
.player-buttons button {
background: none;
border: none;
color: var(--text-secondary);
cursor: pointer;
font-size: 18px;
transition: color 0.2s;
padding: 4px;
}
.player-buttons button:hover {
color: var(--text-primary);
}
.player-buttons .play-btn {
width: 40px;
height: 40px;
border-radius: 50%;
background: var(--primary);
color: white;
display: flex;
align-items: center;
justify-content: center;
font-size: 16px;
}
.player-buttons .play-btn:hover {
background: var(--primary-dark);
color: white;
}
.player-progress {
width: 100%;
max-width: 600px;
display: flex;
align-items: center;
gap: 8px;
}
.player-progress .time {
font-size: 11px;
color: var(--text-muted);
min-width: 40px;
}
.player-progress .time:last-child {
text-align: right;
}
.progress-bar {
flex: 1;
height: 4px;
background: var(--border-color);
border-radius: 2px;
cursor: pointer;
position: relative;
}
.progress-bar .progress {
height: 100%;
background: var(--primary);
border-radius: 2px;
position: relative;
transition: width 0.1s linear;
}
.progress-bar .progress::after {
content: '';
position: absolute;
right: -6px;
top: -4px;
width: 12px;
height: 12px;
border-radius: 50%;
background: var(--primary);
opacity: 0;
transition: opacity 0.2s;
}
.progress-bar:hover .progress::after {
opacity: 1;
}
.player-extra {
display: flex;
align-items: center;
gap: 16px;
width: 240px;
justify-content: flex-end;
}
.player-extra button {
background: none;
border: none;
color: var(--text-secondary);
cursor: pointer;
font-size: 16px;
transition: color 0.2s;
}
.player-extra button:hover {
color: var(--text-primary);
}
.volume-control {
display: flex;
align-items: center;
gap: 6px;
}
.volume-bar {
width: 80px;
height: 4px;
background: var(--border-color);
border-radius: 2px;
cursor: pointer;
}
.volume-bar .volume {
height: 100%;
background: var(--text-secondary);
border-radius: 2px;
width: 70%;
}
/* ============ 歌词面板 ============ */
.lyrics-panel {
position: fixed;
top: var(--header-height);
right: -400px;
width: 380px;
height: calc(100vh - var(--header-height) - var(--player-height));
background: rgba(26, 26, 46, 0.98);
backdrop-filter: blur(20px);
border-left: 1px solid var(--border-color);
transition: right 0.3s ease;
z-index: 999;
overflow: hidden;
display: flex;
flex-direction: column;
}
.lyrics-panel.open {
right: 0;
}
.lyrics-header {
padding: 20px;
border-bottom: 1px solid var(--border-color);
display: flex;
align-items: center;
justify-content: space-between;
}
.lyrics-header h3 {
font-size: 16px;
}
.lyrics-header .close-btn {
background: none;
border: none;
color: var(--text-secondary);
cursor: pointer;
font-size: 20px;
}
.lyrics-content {
flex: 1;
overflow-y: auto;
padding: 30px 20px;
scroll-behavior: smooth;
}
.lyrics-line {
padding: 8px 0;
font-size: 15px;
color: var(--text-muted);
text-align: center;
transition: all 0.3s;
cursor: pointer;
}
.lyrics-line:hover {
color: var(--text-secondary);
}
.lyrics-line.active {
color: var(--text-primary);
font-size: 17px;
font-weight: 600;
transform: scale(1.05);
}
.lyrics-empty {
text-align: center;
color: var(--text-muted);
margin-top: 40%;
}
/* ============ 详情页 ============ */
.detail-header {
display: flex;
padding: 30px 0;
gap: 30px;
}
.detail-cover {
width: 220px;
height: 220px;
border-radius: 12px;
overflow: hidden;
background: var(--bg-card);
flex-shrink: 0;
box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}
.detail-cover img {
width: 100%;
height: 100%;
object-fit: cover;
}
.detail-info {
flex: 1;
display: flex;
flex-direction: column;
justify-content: flex-end;
}
.detail-info .type {
font-size: 12px;
color: var(--text-muted);
text-transform: uppercase;
letter-spacing: 1px;
margin-bottom: 8px;
}
.detail-info h1 {
font-size: 32px;
font-weight: 700;
margin-bottom: 12px;
}
.detail-info .meta {
font-size: 13px;
color: var(--text-secondary);
margin-bottom: 16px;
}
.detail-info .actions {
display: flex;
gap: 12px;
}
.btn-primary {
background: var(--primary);
color: white;
border: none;
padding: 10px 24px;
border-radius: 20px;
font-size: 14px;
cursor: pointer;
transition: background 0.2s;
display: flex;
align-items: center;
gap: 6px;
}
.btn-primary:hover {
background: var(--primary-dark);
}
.btn-secondary {
background: transparent;
color: var(--text-primary);
border: 1px solid var(--border-color);
padding: 10px 24px;
border-radius: 20px;
font-size: 14px;
cursor: pointer;
transition: all 0.2s;
}
.btn-secondary:hover {
border-color: var(--text-secondary);
}
/* ============ 搜索结果页 ============ */
.search-results {
padding: 20px 0;
}
.search-tabs {
display: flex;
gap: 20px;
margin-bottom: 20px;
border-bottom: 1px solid var(--border-color);
padding-bottom: 12px;
}
.search-tabs .tab {
padding: 6px 16px;
border-radius: 16px;
cursor: pointer;
font-size: 14px;
color: var(--text-secondary);
transition: all 0.2s;
}
.search-tabs .tab.active {
background: var(--primary);
color: white;
}
/* ============ 占位图 ============ */
.placeholder-cover {
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
background: linear-gradient(135deg, var(--bg-surface), var(--bg-card));
color: var(--text-muted);
font-size: 32px;
}
/* ============ 响应式 - 平板 ============ */
@media (max-width: 1024px) {
.banner-section {
height: 220px;
}
.playlist-grid {
grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}
.player-song {
width: 180px;
min-width: 160px;
}
.player-extra {
width: 180px;
}
.lyrics-panel {
width: 320px;
}
}
/* ============ 响应式 - 手机 ============ */
@media (max-width: 768px) {
:root {
--header-height: 50px;
--player-height: 64px;
}
.header {
padding: 0 12px;
}
.header-logo {
font-size: 18px;
margin-right: 12px;
}
.header-nav {
display: none;
}
.header-search input {
width: 140px;
}
.header-search input:focus {
width: 180px;
}
.main-content {
padding: 12px;
}
.banner-section {
height: 160px;
border-radius: 8px;
}
.banner-overlay h2 {
font-size: 16px;
}
.section-title h3 {
font-size: 17px;
}
.playlist-grid {
grid-template-columns: repeat(3, 1fr);
gap: 12px;
}
.artist-grid {
grid-template-columns: repeat(3, 1fr);
gap: 12px;
}
.artist-card .avatar {
width: 80px;
height: 80px;
}
.album-grid {
grid-template-columns: repeat(3, 1fr);
gap: 12px;
}
.song-item {
padding: 8px 10px;
}
.song-item .cover {
width: 40px;
height: 40px;
margin: 0 8px;
}
.song-item .duration {
display: none;
}
.song-item .actions {
display: none;
}
/* 播放器 */
.player {
padding: 0 10px;
}
.player-song {
width: auto;
flex: 1;
min-width: 0;
}
.player-song .cover {
width: 44px;
height: 44px;
margin-right: 8px;
}
.player-song .info .name {
max-width: 100px;
}
.player-controls {
flex: 0;
padding: 0;
}
.player-buttons {
gap: 12px;
margin-bottom: 0;
}
.player-buttons .prev-btn,
.player-buttons .next-btn {
display: none;
}
.player-progress {
display: none;
}
.player-extra {
display: none;
}
/* 歌词面板全屏 */
.lyrics-panel {
width: 100%;
right: -100%;
top: 0;
height: 100vh;
z-index: 1002;
}
/* 详情页 */
.detail-header {
flex-direction: column;
align-items: center;
text-align: center;
padding: 20px 0;
}
.detail-cover {
width: 180px;
height: 180px;
}
.detail-info h1 {
font-size: 22px;
}
.detail-info .actions {
justify-content: center;
}
}
@media (max-width: 480px) {
.playlist-grid {
grid-template-columns: repeat(2, 1fr);
gap: 10px;
}
.artist-grid {
grid-template-columns: repeat(2, 1fr);
}
.album-grid {
grid-template-columns: repeat(2, 1fr);
}
}
/* ============ 动画 ============ */
.fade-in {
animation: fadeIn 0.3s ease;
}
@keyframes slideUp {
from { transform: translateY(20px); opacity: 0; }
to { transform: translateY(0); opacity: 1; }
}
.slide-up {
animation: slideUp 0.4s ease;
}
/* ============ 加载状态 ============ */
.loading {
text-align: center;
padding: 40px;
color: var(--text-muted);
}
.loading::after {
content: '';
display: inline-block;
width: 24px;
height: 24px;
border: 2px solid var(--border-color);
border-top-color: var(--primary);
border-radius: 50%;
animation: spin 0.8s linear infinite;
margin-left: 8px;
vertical-align: middle;
}
@keyframes spin {
to { transform: rotate(360deg); }
}