* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Microsoft JhengHei", Arial, sans-serif;
    background: #f4f6fb;
    color: #1f2937;
}

.topbar {
    background: linear-gradient(135deg, #1e3a8a, #2563eb);
    color: white;
    padding: 22px 6%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    background: #ffffff;
    color: #2563eb;
    display: grid;
    place-items: center;
    font-size: 32px;
    font-weight: bold;
}

.brand h1 {
    margin: 0;
    font-size: 28px;
}

.brand p {
    margin: 4px 0 0;
    opacity: 0.85;
}

.menu {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.menu a {
    color: white;
    text-decoration: none;
    padding: 9px 14px;
    border-radius: 999px;
    background: rgba(255,255,255,0.15);
}

.menu a:hover {
    background: rgba(255,255,255,0.28);
}

.container {
    width: min(1100px, 94%);
    margin: 24px auto;
}

.card,
.player-section,
.toolbar {
    background: white;
    border-radius: 18px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
    padding: 22px;
    margin-bottom: 22px;
}

.player-section {
    position: sticky;
    top: 10px;
    z-index: 20;
    border: 1px solid #dbeafe;
}

.player-section h2,
.card h2,
#songListSection h2 {
    margin-top: 0;
}

.now-playing {
    margin-bottom: 14px;
    padding: 12px 14px;
    border-radius: 12px;
    background: #eff6ff;
    color: #1d4ed8;
    font-weight: bold;
}

.player-box iframe {
    width: 100%;
    height: 320px;
    border: 0;
    border-radius: 14px;
}

.player-box audio {
    width: 100%;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.form-group.full {
    grid-column: 1 / -1;
}

label {
    font-weight: bold;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    padding: 11px 12px;
    font-size: 15px;
    outline: none;
    background: white;
}

input:focus,
select:focus,
textarea:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}

.button-row {
    display: flex;
    gap: 10px;
    margin-top: 18px;
    flex-wrap: wrap;
}

.btn {
    border: 0;
    border-radius: 12px;
    padding: 10px 15px;
    cursor: pointer;
    font-weight: bold;
    font-size: 15px;
}

.btn.primary {
    background: #2563eb;
    color: white;
}

.btn.primary:hover {
    background: #1d4ed8;
}

.btn.secondary {
    background: #e5e7eb;
    color: #111827;
}

.btn.secondary:hover {
    background: #d1d5db;
}

.btn.danger {
    background: #ef4444;
    color: white;
}

.btn.danger:hover {
    background: #dc2626;
}

.btn.like {
    background: #f97316;
    color: white;
}

.btn.play {
    background: #10b981;
    color: white;
}

.toolbar {
    display: flex;
    gap: 12px;
    align-items: center;
}

.toolbar input {
    flex: 1;
}

.toolbar select {
    max-width: 180px;
}

.song-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
}

.song-card {
    background: white;
    border-radius: 18px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
    padding: 18px;
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 18px;
}

.cover {
    width: 120px;
    height: 120px;
    border-radius: 16px;
    object-fit: cover;
    background: #e5e7eb;
}

.no-cover {
    width: 120px;
    height: 120px;
    border-radius: 16px;
    background: linear-gradient(135deg, #93c5fd, #2563eb);
    color: white;
    display: grid;
    place-items: center;
    font-size: 42px;
    font-weight: bold;
}

.song-content h3 {
    margin: 0 0 5px;
    font-size: 22px;
}

.meta {
    color: #64748b;
    font-size: 14px;
    margin-bottom: 8px;
}

.badge {
    display: inline-block;
    padding: 4px 9px;
    border-radius: 999px;
    background: #dbeafe;
    color: #1d4ed8;
    font-size: 13px;
    margin-right: 6px;
}

.song-desc {
    line-height: 1.65;
    margin: 10px 0 6px;
    white-space: pre-wrap;
}

.song-desc.clamped {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 標準屬性，部分瀏覽器支援 */
.song-desc.clamped {
    line-clamp: 3;
}

.more-btn {
    border: 0;
    background: transparent;
    color: #2563eb;
    font-weight: bold;
    cursor: pointer;
    padding: 0;
    margin-bottom: 10px;
}

.song-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0;
}

.comments {
    margin-top: 14px;
    border-top: 1px solid #e5e7eb;
    padding-top: 12px;
}

.comment-item {
    background: #f8fafc;
    border-radius: 12px;
    padding: 10px 12px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.comment-text {
    white-space: pre-wrap;
}

.comment-date {
    color: #64748b;
    font-size: 12px;
    margin-top: 3px;
}

.comment-form {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.comment-form input {
    flex: 1;
}

.muted {
    color: #64748b;
}

.footer {
    text-align: center;
    color: #64748b;
    padding: 30px 0;
}

.loading,
.error,
.empty {
    background: white;
    padding: 22px;
    border-radius: 18px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.error {
    color: #b91c1c;
    background: #fee2e2;
}

@media (max-width: 760px) {
    .form-grid {
        grid-template-columns: 1fr;
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .toolbar select {
        max-width: none;
    }

    .song-card {
        grid-template-columns: 1fr;
    }

    .cover,
    .no-cover {
        width: 100%;
        height: 180px;
    }

    .player-box iframe {
        height: 220px;
    }

    .comment-form {
        flex-direction: column;
    }

    .btn.liked-disabled,
    .btn.liked-disabled:hover {
       background: #9ca3af;
       color: white;
       cursor: not-allowed;
       opacity: 0.8;
}

}
